code_ownership 1.34.1 → 1.35.0
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 +7 -1
- data/lib/code_ownership/configuration.rb +3 -1
- data/lib/code_ownership/private/team_plugins/github.rb +18 -1
- data/lib/code_ownership.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 687d34f0d9ad8f7421b0a599904c697e10b34ec9f638a47f1e861b2e858bf091
|
4
|
+
data.tar.gz: b8beee01bb8e5ff88d73117a05ad8c99c04e3ee3a7434f1a92da0e15cc7839dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c30fb93a5e634f648f00ab7269d0744cbb9dc120b3c472769a116e59066190560845ae8ee660750efb81c10d8c483373ffda8058d523ac50f16fa05266cf9e29
|
7
|
+
data.tar.gz: 1843017837ed962de655069fcb64d7d5121e72eb6375df14b8a7be8c35d6b9b55ba3e592bb9a240374964002ea65d1c7f87a0ddd6d565a1c74e4276c51bb56fb
|
data/README.md
CHANGED
@@ -73,6 +73,12 @@ js_package_paths:
|
|
73
73
|
|
74
74
|
This defaults `**/`, which makes it look for `package.json` files across your application.
|
75
75
|
|
76
|
+
> [!NOTE]
|
77
|
+
> Javscript 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.
|
78
|
+
```yml
|
79
|
+
js_package_paths: []
|
80
|
+
```
|
81
|
+
|
76
82
|
### Custom Ownership
|
77
83
|
To enable custom ownership, you can inject your own custom classes into `code_ownership`.
|
78
84
|
To do this, first create a class that adheres to the `CodeOwnership::Mapper` and/or `CodeOwnership::Validator` interface.
|
@@ -155,7 +161,7 @@ unowned_globs:
|
|
155
161
|
- app/services/some_file2.rb
|
156
162
|
- frontend/javascripts/**/__generated__/**/*
|
157
163
|
```
|
158
|
-
You can call the validation function with the Ruby API
|
164
|
+
You can call the validation function with the Ruby API
|
159
165
|
```ruby
|
160
166
|
CodeOwnership.validate!
|
161
167
|
```
|
@@ -11,6 +11,7 @@ module CodeOwnership
|
|
11
11
|
const :unbuilt_gems_path, T.nilable(String)
|
12
12
|
const :skip_codeowners_validation, T::Boolean
|
13
13
|
const :raw_hash, T::Hash[T.untyped, T.untyped]
|
14
|
+
const :require_github_teams, T::Boolean
|
14
15
|
|
15
16
|
sig { returns(Configuration) }
|
16
17
|
def self.fetch
|
@@ -27,7 +28,8 @@ module CodeOwnership
|
|
27
28
|
unowned_globs: config_hash.fetch('unowned_globs', []),
|
28
29
|
js_package_paths: js_package_paths(config_hash),
|
29
30
|
skip_codeowners_validation: config_hash.fetch('skip_codeowners_validation', false),
|
30
|
-
raw_hash: config_hash
|
31
|
+
raw_hash: config_hash,
|
32
|
+
require_github_teams: config_hash.fetch('require_github_teams', false)
|
31
33
|
)
|
32
34
|
end
|
33
35
|
|
@@ -21,7 +21,7 @@ module CodeOwnership
|
|
21
21
|
|
22
22
|
sig { override.params(teams: T::Array[CodeTeams::Team]).returns(T::Array[String]) }
|
23
23
|
def self.validation_errors(teams)
|
24
|
-
all_github_teams = teams.flat_map { |team| self.for(team).github.team }
|
24
|
+
all_github_teams = teams.flat_map { |team| self.for(team).github.team }.compact
|
25
25
|
|
26
26
|
teams_used_more_than_once = all_github_teams.tally.select do |_team, count|
|
27
27
|
count > 1
|
@@ -29,6 +29,18 @@ module CodeOwnership
|
|
29
29
|
|
30
30
|
errors = T.let([], T::Array[String])
|
31
31
|
|
32
|
+
if require_github_teams?
|
33
|
+
missing_github_teams = teams.select { |team| self.for(team).github.team.nil? }
|
34
|
+
|
35
|
+
if missing_github_teams.any?
|
36
|
+
errors << <<~ERROR
|
37
|
+
The following teams are missing `github.team` entries:
|
38
|
+
|
39
|
+
#{missing_github_teams.map(&:config_yml).join("\n")}
|
40
|
+
ERROR
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
32
44
|
if teams_used_more_than_once.any?
|
33
45
|
errors << <<~ERROR
|
34
46
|
The following teams are specified multiple times:
|
@@ -40,6 +52,11 @@ module CodeOwnership
|
|
40
52
|
|
41
53
|
errors
|
42
54
|
end
|
55
|
+
|
56
|
+
sig { returns(T::Boolean) }
|
57
|
+
def self.require_github_teams?
|
58
|
+
CodeOwnership.configuration.require_github_teams
|
59
|
+
end
|
43
60
|
end
|
44
61
|
end
|
45
62
|
end
|
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: 1.
|
4
|
+
version: 1.35.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gusto Engineers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: code_teams
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: packs
|
28
|
+
name: packs-specification
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|