code_ownership 2.1.1-aarch64-linux → 2.1.2-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/lib/code_ownership/3.3/code_ownership.so +0 -0
- data/lib/code_ownership/3.4/code_ownership.so +0 -0
- data/lib/code_ownership/4.0/code_ownership.so +0 -0
- data/lib/code_ownership/private/file_path_finder.rb +19 -3
- data/lib/code_ownership/private/team_finder.rb +1 -2
- data/lib/code_ownership/version.rb +1 -1
- data/lib/code_ownership.rb +2 -0
- metadata +3 -4
- data/lib/code_ownership/3.2/code_ownership.so +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e65314f52f9986368a99499f6dc54015f8e7e723c611472311da625679dfd59d
|
|
4
|
+
data.tar.gz: 7ce407e87f9eaee89ae9fd2155a1e20a326ac262779a5930539a145e2363ed79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b992b3d32d5df9554f915da2984a8594b5d3abe339d475a5e013e9f6377879784cbb943b3fde65ff4d3f8dce3256d7b9dc148c71d7d220122df56592593a668
|
|
7
|
+
data.tar.gz: 7961dd4efdce04dc4d3f3ff187efbdc715b7d8d5c439e173f29bcb3e75fb89ebfd45f5015e718a7d2bb807f6144c30fe6d2326a4d6df607c0097e6474d78ad33
|
data/README.md
CHANGED
|
@@ -10,7 +10,7 @@ There is also a [companion VSCode Extension](https://github.com/rubyatscale/code
|
|
|
10
10
|
|
|
11
11
|
## Getting started
|
|
12
12
|
|
|
13
|
-
To get started there
|
|
13
|
+
To get started there are a few things you should do.
|
|
14
14
|
|
|
15
15
|
1. Create a `config/code_ownership.yml` file and declare where your files live. Here's a sample to start with:
|
|
16
16
|
|
|
@@ -42,7 +42,7 @@ There are five ways to declare code ownership using this gem:
|
|
|
42
42
|
|
|
43
43
|
### Directory-Based Ownership
|
|
44
44
|
|
|
45
|
-
Directory
|
|
45
|
+
Directory-based ownership allows for all files in that directory and all its sub-directories to be owned by one team. To define this, add a `.codeowner` file inside that directory with the name of the team as the contents of that file.
|
|
46
46
|
|
|
47
47
|
```
|
|
48
48
|
Team
|
|
@@ -58,7 +58,7 @@ File annotations are a last resort if there is no clear home for your code. File
|
|
|
58
58
|
|
|
59
59
|
### Package-Based Ownership
|
|
60
60
|
|
|
61
|
-
Package
|
|
61
|
+
Package-based ownership integrates [`packwerk`](https://github.com/Shopify/packwerk) and has ownership defined per package. To define that all files within a package are owned by one team, configure your `package.yml` like this:
|
|
62
62
|
|
|
63
63
|
```yml
|
|
64
64
|
enforce_dependency: true
|
|
@@ -92,7 +92,7 @@ unowned_globs:
|
|
|
92
92
|
|
|
93
93
|
### Javascript Package Ownership
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
JavaScript package-based ownership allows you to specify an ownership key in a `package.json`. To use this, configure your `package.json` like this:
|
|
96
96
|
|
|
97
97
|
```json
|
|
98
98
|
{
|
|
@@ -112,10 +112,10 @@ js_package_paths:
|
|
|
112
112
|
- frontend/other_location_for_packages/*
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
This defaults `**/`, which makes it look for `package.json` files across your application.
|
|
115
|
+
This defaults to `**/`, which makes it look for `package.json` files across your application.
|
|
116
116
|
|
|
117
117
|
> [!NOTE]
|
|
118
|
-
>
|
|
118
|
+
> JavaScript package ownership does not respect `unowned_globs`. If you wish to disable usage of this feature you can set `js_package_paths` to an empty list.
|
|
119
119
|
|
|
120
120
|
```yml
|
|
121
121
|
js_package_paths: []
|
|
@@ -184,7 +184,7 @@ If `codeowners_path` is set in `code_ownership.yml` codeowners will use that pat
|
|
|
184
184
|
CodeOwnership comes with a validation function to ensure the following things are true:
|
|
185
185
|
|
|
186
186
|
1. Only one mechanism is defining file ownership. That is -- you can't have a file annotation on a file owned via package-based or glob-based ownership. This helps make ownership behavior more clear by avoiding concerns about precedence.
|
|
187
|
-
2. All teams referenced as an owner for any file or package
|
|
187
|
+
2. All teams referenced as an owner for any file or package are valid teams (i.e. they're in the list of `CodeTeams.all`).
|
|
188
188
|
3. All files have ownership. You can specify in `unowned_globs` to represent a TODO list of files to add ownership to.
|
|
189
189
|
4. The `.github/CODEOWNERS` file is up to date. This is automatically corrected and staged unless specified otherwise with `bin/codeownership validate --skip-autocorrect --skip-stage`. You can turn this validation off by setting `skip_codeowners_validation: true` in `config/code_ownership.yml`.
|
|
190
190
|
|
|
@@ -223,7 +223,7 @@ codeownership validate --diff
|
|
|
223
223
|
|
|
224
224
|
## Development
|
|
225
225
|
|
|
226
|
-
Please add to `CHANGELOG.md` and this `README.md` when you make
|
|
226
|
+
Please add to `CHANGELOG.md` and this `README.md` when you make changes.
|
|
227
227
|
|
|
228
228
|
## Running specs
|
|
229
229
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -6,13 +6,29 @@ module CodeOwnership
|
|
|
6
6
|
module FilePathFinder
|
|
7
7
|
extend T::Sig
|
|
8
8
|
|
|
9
|
+
sig { returns(String) }
|
|
10
|
+
def self.pwd_prefix
|
|
11
|
+
@pwd_prefix ||= T.let("#{Dir.pwd}/", T.nilable(String))
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
sig { returns(Pathname) }
|
|
15
|
+
def self.pwd
|
|
16
|
+
@pwd ||= T.let(Pathname.pwd, T.nilable(Pathname))
|
|
17
|
+
end
|
|
18
|
+
|
|
9
19
|
# Returns a string version of the relative path to a Rails constant,
|
|
10
20
|
# or nil if it can't find anything
|
|
11
21
|
sig { params(klass: T.nilable(T.any(T::Class[T.anything], T::Module[T.anything]))).returns(T.nilable(String)) }
|
|
12
22
|
def self.path_from_klass(klass)
|
|
13
23
|
if klass
|
|
14
24
|
path = Object.const_source_location(klass.to_s)&.first
|
|
15
|
-
|
|
25
|
+
return nil unless path
|
|
26
|
+
|
|
27
|
+
if path.start_with?(pwd_prefix)
|
|
28
|
+
path.delete_prefix(pwd_prefix)
|
|
29
|
+
else
|
|
30
|
+
Pathname.new(path).relative_path_from(pwd).to_s
|
|
31
|
+
end
|
|
16
32
|
end
|
|
17
33
|
rescue NameError
|
|
18
34
|
nil
|
|
@@ -30,7 +46,7 @@ module CodeOwnership
|
|
|
30
46
|
# ./app/controllers/some_controller.rb:43:in `block (3 levels) in create'
|
|
31
47
|
#
|
|
32
48
|
backtrace_line = if RUBY_VERSION >= '3.4.0'
|
|
33
|
-
%r{\A(#{
|
|
49
|
+
%r{\A(#{pwd}/|\./)?
|
|
34
50
|
(?<file>.+) # Matches 'app/controllers/some_controller.rb'
|
|
35
51
|
:
|
|
36
52
|
(?<line>\d+) # Matches '43'
|
|
@@ -38,7 +54,7 @@ module CodeOwnership
|
|
|
38
54
|
'(?<function>.*)' # Matches "`block (3 levels) in create'"
|
|
39
55
|
\z}x
|
|
40
56
|
else
|
|
41
|
-
%r{\A(#{
|
|
57
|
+
%r{\A(#{pwd}/|\./)?
|
|
42
58
|
(?<file>.+) # Matches 'app/controllers/some_controller.rb'
|
|
43
59
|
:
|
|
44
60
|
(?<line>\d+) # Matches '43'
|
|
@@ -13,9 +13,8 @@ module CodeOwnership
|
|
|
13
13
|
return FilePathTeamCache.get(file_path) if FilePathTeamCache.cached?(file_path)
|
|
14
14
|
|
|
15
15
|
result = T.let(RustCodeOwners.for_file(file_path), T.nilable(T::Hash[Symbol, String]))
|
|
16
|
-
return if result.nil?
|
|
17
16
|
|
|
18
|
-
if result[:team_name].nil?
|
|
17
|
+
if result.nil? || result[:team_name].nil?
|
|
19
18
|
FilePathTeamCache.set(file_path, nil)
|
|
20
19
|
else
|
|
21
20
|
FilePathTeamCache.set(file_path, T.let(find_team!(T.must(result[:team_name]), allow_raise: allow_raise), T.nilable(CodeTeams::Team)))
|
data/lib/code_ownership.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: code_ownership
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.2
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Gusto Engineers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: code_teams
|
|
@@ -176,7 +176,6 @@ files:
|
|
|
176
176
|
- README.md
|
|
177
177
|
- bin/codeownership
|
|
178
178
|
- lib/code_ownership.rb
|
|
179
|
-
- lib/code_ownership/3.2/code_ownership.so
|
|
180
179
|
- lib/code_ownership/3.3/code_ownership.so
|
|
181
180
|
- lib/code_ownership/3.4/code_ownership.so
|
|
182
181
|
- lib/code_ownership/4.0/code_ownership.so
|
|
@@ -204,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
204
203
|
requirements:
|
|
205
204
|
- - ">="
|
|
206
205
|
- !ruby/object:Gem::Version
|
|
207
|
-
version: '3.
|
|
206
|
+
version: '3.3'
|
|
208
207
|
- - "<"
|
|
209
208
|
- !ruby/object:Gem::Version
|
|
210
209
|
version: 4.1.dev
|
|
Binary file
|