code_ownership 1.30.0 → 1.31.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9810b0bbef35bf354841da08d53391f864e213540ebb61fa5117b98df3b20ba9
4
- data.tar.gz: 70dd498844898d361494a86a0c57da788d69cbd7c03eb7e3883c0d4520781089
3
+ metadata.gz: 5f18626234130fdbd4637847307299048bed10e57619e9fa695f94d05e22f398
4
+ data.tar.gz: 07a11ca7265a02ab547501072867cffc9f4d2b3e194de9f919deb829dc240ad5
5
5
  SHA512:
6
- metadata.gz: d17b0680d21a907fb5581fa98adc16255984580ac2336a2170d69ab1d11b281d9d180e68e2866435ed5aab8dec1dab90f5849d8431311ddaa3d9014c6a961e9d
7
- data.tar.gz: 3e1d9cf9e16234c199085f1de858590af922c7416a219a84fbc3c55c274a1eff59c7b6dba95e66b46f141328dcbd82005cbdaa55cb45b5d0dac32d2778156602
6
+ metadata.gz: d742401692975e16d26305c0fdd22671c34b9d67172da3ffc5b38846ec512761229dd6cc5f4a19c86e9b2c95cddd1e96b1a4452aebe571c4ae2f534ea834d2bf
7
+ data.tar.gz: c06b4fad39595de7d5e74492483a4d326358bfdc8604340abd54686ed0543283d570c34d3f051923f8a080b9a6b75fa037d75dcd9aed570df7ae6e9da60e42b6
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ # typed: true
4
+
5
+ module CodeOwnership
6
+ module Private
7
+ module OwnershipMappers
8
+ class TeamYmlOwnership
9
+ extend T::Sig
10
+ include Interface
11
+
12
+ @@map_files_to_owners = T.let(@map_files_to_owners, T.nilable(T::Hash[String, T.nilable(::CodeTeams::Team)])) # rubocop:disable Style/ClassVars
13
+ @@map_files_to_owners = {} # rubocop:disable Style/ClassVars
14
+ @@codeowners_lines_to_owners = T.let(@codeowners_lines_to_owners, T.nilable(T::Hash[String, T.nilable(::CodeTeams::Team)])) # rubocop:disable Style/ClassVars
15
+ @@codeowners_lines_to_owners = {} # rubocop:disable Style/ClassVars
16
+
17
+ sig do
18
+ override.
19
+ params(files: T::Array[String]).
20
+ returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
21
+ end
22
+ def map_files_to_owners(files) # rubocop:disable Lint/UnusedMethodArgument
23
+ return @@map_files_to_owners if @@map_files_to_owners&.keys && @@map_files_to_owners.keys.count > 0
24
+
25
+ @@map_files_to_owners = CodeTeams.all.each_with_object({}) do |team, map| # rubocop:disable Style/ClassVars
26
+ map[team.config_yml] = team
27
+ end
28
+ end
29
+
30
+ sig do
31
+ override.params(file: String).
32
+ returns(T.nilable(::CodeTeams::Team))
33
+ end
34
+ def map_file_to_owner(file)
35
+ map_files_to_owners([file])[file]
36
+ end
37
+
38
+ sig do
39
+ override.returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
40
+ end
41
+ def codeowners_lines_to_owners
42
+ return @@codeowners_lines_to_owners if @@codeowners_lines_to_owners&.keys && @@codeowners_lines_to_owners.keys.count > 0
43
+
44
+ @@codeowners_lines_to_owners = CodeTeams.all.each_with_object({}) do |team, map| # rubocop:disable Style/ClassVars
45
+ map[team.config_yml] = team
46
+ end
47
+ end
48
+
49
+ sig { override.void }
50
+ def bust_caches!
51
+ @@codeowners_lines_to_owners = {} # rubocop:disable Style/ClassVars
52
+ @@map_files_to_owners = {} # rubocop:disable Style/ClassVars
53
+ end
54
+
55
+ sig { override.returns(String) }
56
+ def description
57
+ 'Team YML ownership'
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -16,6 +16,7 @@ require 'code_ownership/private/ownership_mappers/file_annotations'
16
16
  require 'code_ownership/private/ownership_mappers/team_globs'
17
17
  require 'code_ownership/private/ownership_mappers/package_ownership'
18
18
  require 'code_ownership/private/ownership_mappers/js_package_ownership'
19
+ require 'code_ownership/private/ownership_mappers/team_yml_ownership'
19
20
 
20
21
  module CodeOwnership
21
22
  module Private
@@ -64,6 +65,7 @@ module CodeOwnership
64
65
  Private::OwnershipMappers::TeamGlobs.new,
65
66
  Private::OwnershipMappers::PackageOwnership.new,
66
67
  Private::OwnershipMappers::JsPackageOwnership.new,
68
+ Private::OwnershipMappers::TeamYmlOwnership.new,
67
69
  ]
68
70
  end
69
71
 
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.30.0
4
+ version: 1.31.1
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-02-22 00:00:00.000000000 Z
11
+ date: 2023-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: code_teams
@@ -141,6 +141,7 @@ files:
141
141
  - lib/code_ownership/private/ownership_mappers/js_package_ownership.rb
142
142
  - lib/code_ownership/private/ownership_mappers/package_ownership.rb
143
143
  - lib/code_ownership/private/ownership_mappers/team_globs.rb
144
+ - lib/code_ownership/private/ownership_mappers/team_yml_ownership.rb
144
145
  - lib/code_ownership/private/parse_js_packages.rb
145
146
  - lib/code_ownership/private/team_plugins/github.rb
146
147
  - lib/code_ownership/private/team_plugins/ownership.rb
@@ -149,11 +150,6 @@ files:
149
150
  - lib/code_ownership/private/validations/github_codeowners_up_to_date.rb
150
151
  - lib/code_ownership/private/validations/interface.rb
151
152
  - lib/code_ownership/private/validations/no_overlapping_globs.rb
152
- - sorbet/config
153
- - sorbet/rbi/gems/code_teams@1.0.0.rbi
154
- - sorbet/rbi/gems/packs@0.0.2.rbi
155
- - sorbet/rbi/manual.rbi
156
- - sorbet/rbi/todo.rbi
157
153
  homepage: https://github.com/rubyatscale/code_ownership
158
154
  licenses:
159
155
  - MIT
data/sorbet/config DELETED
@@ -1,5 +0,0 @@
1
- --dir
2
- .
3
- --ignore=/spec
4
- --ignore=/vendor/bundle
5
- --enable-experimental-requires-ancestor
@@ -1,120 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `code_teams` gem.
5
- # Please instead update this file by running `bin/tapioca gem code_teams`.
6
-
7
- module CodeTeams
8
- class << self
9
- sig { returns(T::Array[::CodeTeams::Team]) }
10
- def all; end
11
-
12
- sig { void }
13
- def bust_caches!; end
14
-
15
- sig { params(name: ::String).returns(T.nilable(::CodeTeams::Team)) }
16
- def find(name); end
17
-
18
- sig { params(dir: ::String).returns(T::Array[::CodeTeams::Team]) }
19
- def for_directory(dir); end
20
-
21
- sig { params(string: ::String).returns(::String) }
22
- def tag_value_for(string); end
23
-
24
- sig { params(teams: T::Array[::CodeTeams::Team]).returns(T::Array[::String]) }
25
- def validation_errors(teams); end
26
- end
27
- end
28
-
29
- class CodeTeams::IncorrectPublicApiUsageError < ::StandardError; end
30
-
31
- class CodeTeams::Plugin
32
- abstract!
33
-
34
- sig { params(team: ::CodeTeams::Team).void }
35
- def initialize(team); end
36
-
37
- class << self
38
- sig { returns(T::Array[T.class_of(CodeTeams::Plugin)]) }
39
- def all_plugins; end
40
-
41
- sig { params(team: ::CodeTeams::Team).returns(T.attached_class) }
42
- def for(team); end
43
-
44
- sig { params(base: T.untyped).void }
45
- def inherited(base); end
46
-
47
- sig { params(team: ::CodeTeams::Team, key: ::String).returns(::String) }
48
- def missing_key_error_message(team, key); end
49
-
50
- sig { params(teams: T::Array[::CodeTeams::Team]).returns(T::Array[::String]) }
51
- def validation_errors(teams); end
52
-
53
- private
54
-
55
- sig { params(team: ::CodeTeams::Team).returns(T.attached_class) }
56
- def register_team(team); end
57
-
58
- sig { returns(T::Hash[T.nilable(::String), T::Hash[::Class, ::CodeTeams::Plugin]]) }
59
- def registry; end
60
- end
61
- end
62
-
63
- module CodeTeams::Plugins; end
64
-
65
- class CodeTeams::Plugins::Identity < ::CodeTeams::Plugin
66
- sig { returns(::CodeTeams::Plugins::Identity::IdentityStruct) }
67
- def identity; end
68
-
69
- class << self
70
- sig { override.params(teams: T::Array[::CodeTeams::Team]).returns(T::Array[::String]) }
71
- def validation_errors(teams); end
72
- end
73
- end
74
-
75
- class CodeTeams::Plugins::Identity::IdentityStruct < ::Struct
76
- def name; end
77
- def name=(_); end
78
-
79
- class << self
80
- def [](*_arg0); end
81
- def inspect; end
82
- def members; end
83
- def new(*_arg0); end
84
- end
85
- end
86
-
87
- class CodeTeams::Team
88
- sig { params(config_yml: T.nilable(::String), raw_hash: T::Hash[T.untyped, T.untyped]).void }
89
- def initialize(config_yml:, raw_hash:); end
90
-
91
- sig { params(other: ::Object).returns(T::Boolean) }
92
- def ==(other); end
93
-
94
- sig { returns(T.nilable(::String)) }
95
- def config_yml; end
96
-
97
- def eql?(*args, &blk); end
98
-
99
- sig { returns(::Integer) }
100
- def hash; end
101
-
102
- sig { returns(::String) }
103
- def name; end
104
-
105
- sig { returns(T::Hash[T.untyped, T.untyped]) }
106
- def raw_hash; end
107
-
108
- sig { returns(::String) }
109
- def to_tag; end
110
-
111
- class << self
112
- sig { params(raw_hash: T::Hash[T.untyped, T.untyped]).returns(::CodeTeams::Team) }
113
- def from_hash(raw_hash); end
114
-
115
- sig { params(config_yml: ::String).returns(::CodeTeams::Team) }
116
- def from_yml(config_yml); end
117
- end
118
- end
119
-
120
- CodeTeams::UNKNOWN_TEAM_STRING = T.let(T.unsafe(nil), String)
@@ -1,80 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `packs` gem.
5
- # Please instead update this file by running `bin/tapioca gem packs`.
6
-
7
- module Packs
8
- class << self
9
- sig { returns(T::Array[::Packs::Pack]) }
10
- def all; end
11
-
12
- sig { void }
13
- def bust_cache!; end
14
-
15
- sig { returns(::Packs::Configuration) }
16
- def config; end
17
-
18
- sig { params(blk: T.proc.params(arg0: ::Packs::Configuration).void).void }
19
- def configure(&blk); end
20
-
21
- sig { params(name: ::String).returns(T.nilable(::Packs::Pack)) }
22
- def find(name); end
23
-
24
- sig { params(file_path: T.any(::Pathname, ::String)).returns(T.nilable(::Packs::Pack)) }
25
- def for_file(file_path); end
26
-
27
- private
28
-
29
- sig { returns(T::Array[::Pathname]) }
30
- def package_glob_patterns; end
31
-
32
- sig { returns(T::Hash[::String, ::Packs::Pack]) }
33
- def packs_by_name; end
34
- end
35
- end
36
-
37
- class Packs::Configuration
38
- sig { void }
39
- def initialize; end
40
-
41
- sig { returns(T::Array[::Pathname]) }
42
- def roots; end
43
-
44
- sig { params(roots: T::Array[::String]).void }
45
- def roots=(roots); end
46
- end
47
-
48
- Packs::PACKAGE_FILE = T.let(T.unsafe(nil), String)
49
-
50
- class Packs::Pack < ::T::Struct
51
- const :name, ::String
52
- const :path, ::Pathname
53
- const :raw_hash, T::Hash[T.untyped, T.untyped]
54
- const :relative_path, ::Pathname
55
-
56
- sig { returns(::String) }
57
- def last_name; end
58
-
59
- sig { returns(T::Hash[T.untyped, T.untyped]) }
60
- def metadata; end
61
-
62
- sig { returns(::Pathname) }
63
- def yml; end
64
-
65
- class << self
66
- sig { params(package_yml_absolute_path: ::Pathname).returns(::Packs::Pack) }
67
- def from(package_yml_absolute_path); end
68
-
69
- def inherited(s); end
70
- end
71
- end
72
-
73
- module Packs::Private
74
- class << self
75
- sig { returns(::Pathname) }
76
- def root; end
77
- end
78
- end
79
-
80
- Packs::ROOTS = T.let(T.unsafe(nil), Array)
@@ -1,3 +0,0 @@
1
- class Hash
2
- def to_json; end
3
- end
data/sorbet/rbi/todo.rbi DELETED
@@ -1,6 +0,0 @@
1
- # This file is autogenerated. Do not edit it by hand. Regenerate it with:
2
- # srb rbi todo
3
-
4
- # typed: strong
5
- module ::RSpec; end
6
- module ::SequoiaTree; end