code_ownership 1.25.0 → 1.28.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9217ed67fd18ab3aa4ca0e2baa52632e9a2d6b620ca5adb717ee4b81c6d5510b
4
- data.tar.gz: b3b5e77abd9ff82f0397b8b67cbfb08e5065e7441b08588e9992b559f72d6a3f
3
+ metadata.gz: d73cb8995d6430d05780252417863b38bd14a461bf8f3afe4b9724abb407efea
4
+ data.tar.gz: 7cc3c3c4a2968b8e3a265f990c28395b0c4e6163b7ba48ad2b0c8be64123990c
5
5
  SHA512:
6
- metadata.gz: a0b16cdc80b8d2678432e534b25b21e2262ae1c663808594d1724d62b4284dcb0270bab5e56160570fa4c7e497c07ae003f57854f1cf08c81becd3176686bf2b
7
- data.tar.gz: bf619efd34dceee115036e41860c88d83d86d5d678cb9b09069cd6e74ee5e34219b3fcffa6ecba704a6e5c4e427a30627d3c6eedf605cf58b2db715409564dba
6
+ metadata.gz: 6f2a2c2331aa980b414343e54429ba3ab367fa6a38cdad44811b84193afd8a6d3846baf77ae8b7cd78a2754b65865b5799644382ff5182ba0439bb3cb3884cf6
7
+ data.tar.gz: d0ecc33dd542a3dc606caceb52fb38ed32743a12076f5253b96a2c2c6b7fa24a0b1445df6d1a41878ef350a87fe5075cbb17ebc5bb3964211cbac18ee005bfd5
data/README.md CHANGED
@@ -5,7 +5,7 @@ Check out `lib/code_ownership.rb` to see the public API.
5
5
 
6
6
  Check out `code_ownership_spec.rb` to see examples of how code ownership is used.
7
7
 
8
- There is also a [companion VSCode Extension]([url](https://github.com/bigrails/code-ownership-vscode)) for this gem. Just search `Gusto.code-ownership-vscode` in the VSCode Extension Marketplace.
8
+ There is also a [companion VSCode Extension]([url](https://github.com/rubyatscale/code-ownership-vscode)) for this gem. Just search `Gusto.code-ownership-vscode` in the VSCode Extension Marketplace.
9
9
 
10
10
  ## Usage: Declaring Ownership
11
11
  There are three ways to declare code ownership using this gem.
@@ -19,7 +19,7 @@ metadata:
19
19
  ```
20
20
 
21
21
  ### Glob-Based Ownership
22
- In your team's configured YML (see [`bigrails-teams`](https://github.com/bigrails/bigrails-teams)), you can set `owned_globs` to be a glob of files your team owns. For example, in `my_team.yml`:
22
+ In your team's configured YML (see [`code_teams`](https://github.com/rubyatscale/code_teams)), you can set `owned_globs` to be a glob of files your team owns. For example, in `my_team.yml`:
23
23
  ```yml
24
24
  name: My Team
25
25
  owned_globs:
@@ -33,7 +33,7 @@ File annotations are a last resort if there is no clear home for your code. File
33
33
  ```
34
34
  ## Usage: Reading CodeOwnership
35
35
  ### `for_file`
36
- `CodeOwnership.for_file`, given a relative path to a file returns a `Teams::Team` if there is a team that owns the file, `nil` otherwise.
36
+ `CodeOwnership.for_file`, given a relative path to a file returns a `CodeTeams::Team` if there is a team that owns the file, `nil` otherwise.
37
37
 
38
38
  ```ruby
39
39
  CodeOwnership.for_file('path/to/file/relative/to/application/root.rb')
@@ -44,7 +44,7 @@ Contributor note: If you are making updates to this method or the methods gettin
44
44
  See `code_ownership_spec.rb` for examples.
45
45
 
46
46
  ### `for_backtrace`
47
- `CodeOwnership.for_backtrace` can be given a backtrace and will either return `nil`, or a `Teams::Team`.
47
+ `CodeOwnership.for_backtrace` can be given a backtrace and will either return `nil`, or a `CodeTeams::Team`.
48
48
 
49
49
  ```ruby
50
50
  CodeOwnership.for_backtrace(exception.backtrace)
@@ -56,7 +56,7 @@ See `code_ownership_spec.rb` for an example.
56
56
 
57
57
  ### `for_class`
58
58
 
59
- `CodeOwnership.for_class` can be given a class and will either return `nil`, or a `Teams::Team`.
59
+ `CodeOwnership.for_class` can be given a class and will either return `nil`, or a `CodeTeams::Team`.
60
60
 
61
61
  ```ruby
62
62
  CodeOwnership.for_class(MyClass.name)
@@ -73,7 +73,7 @@ A `CODEOWNERS` file defines who owns specific files or paths in a repository. Wh
73
73
  ## Proper Configuration & Validation
74
74
  CodeOwnership comes with a validation function to ensure the following things are true:
75
75
  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.
76
- 2) All teams referenced as an owner for any file or package is a valid team (i.e. it's in the list of `Teams.all`).
76
+ 2) All teams referenced as an owner for any file or package is a valid team (i.e. it's in the list of `CodeTeams.all`).
77
77
  3) All files have ownership. You can specify in `unowned_globs` to represent a TODO list of files to add ownership to.
78
78
  3) 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 `code_ownership.yml`.
79
79
 
@@ -11,7 +11,19 @@ module CodeOwnership
11
11
  validate!(argv)
12
12
  elsif command == 'for_file'
13
13
  for_file(argv)
14
+ elsif [nil, "help"].include?(command)
15
+ puts <<~USAGE
16
+ Usage: bin/codeownership <subcommand>
17
+
18
+ Subcommands:
19
+ validate - run all validations
20
+ for_file - find code ownership for a single file
21
+ help - display help information about code_ownership
22
+ USAGE
23
+ else
24
+ puts "'#{command}' is not a code_ownership command. See `bin/codeownership help`."
14
25
  end
26
+
15
27
  end
16
28
 
17
29
  def self.validate!(argv)
@@ -18,13 +18,13 @@ module CodeOwnership
18
18
  extend T::Sig
19
19
  include Interface
20
20
 
21
- @@map_files_to_owners = T.let({}, T.nilable(T::Hash[String, T.nilable(::Teams::Team)])) # rubocop:disable Style/ClassVars
21
+ @@map_files_to_owners = T.let({}, T.nilable(T::Hash[String, T.nilable(::CodeTeams::Team)])) # rubocop:disable Style/ClassVars
22
22
 
23
23
  TEAM_PATTERN = T.let(/\A(?:#|\/\/) @team (?<team>.*)\Z/.freeze, Regexp)
24
24
 
25
25
  sig do
26
26
  override.params(file: String).
27
- returns(T.nilable(::Teams::Team))
27
+ returns(T.nilable(::CodeTeams::Team))
28
28
  end
29
29
  def map_file_to_owner(file)
30
30
  file_annotation_based_owner(file)
@@ -33,7 +33,7 @@ module CodeOwnership
33
33
  sig do
34
34
  override.
35
35
  params(files: T::Array[String]).
36
- returns(T::Hash[String, T.nilable(::Teams::Team)])
36
+ returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
37
37
  end
38
38
  def map_files_to_owners(files)
39
39
  return @@map_files_to_owners if @@map_files_to_owners&.keys && @@map_files_to_owners.keys.count > 0
@@ -46,7 +46,7 @@ module CodeOwnership
46
46
  end
47
47
  end
48
48
 
49
- sig { params(filename: String).returns(T.nilable(Teams::Team)) }
49
+ sig { params(filename: String).returns(T.nilable(CodeTeams::Team)) }
50
50
  def file_annotation_based_owner(filename)
51
51
  # If for a directory is named with an ownable extension, we need to skip
52
52
  # so File.foreach doesn't blow up below. This was needed because Cypress
@@ -97,7 +97,7 @@ module CodeOwnership
97
97
  end
98
98
 
99
99
  sig do
100
- override.returns(T::Hash[String, T.nilable(::Teams::Team)])
100
+ override.returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
101
101
  end
102
102
  def codeowners_lines_to_owners
103
103
  @@map_files_to_owners = nil # rubocop:disable Style/ClassVars
@@ -16,7 +16,7 @@ module CodeOwnership
16
16
  #
17
17
  sig do
18
18
  abstract.params(file: String).
19
- returns(T.nilable(::Teams::Team))
19
+ returns(T.nilable(::CodeTeams::Team))
20
20
  end
21
21
  def map_file_to_owner(file)
22
22
  end
@@ -26,13 +26,13 @@ module CodeOwnership
26
26
  #
27
27
  sig do
28
28
  abstract.params(files: T::Array[String]).
29
- returns(T::Hash[String, T.nilable(::Teams::Team)])
29
+ returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
30
30
  end
31
31
  def map_files_to_owners(files)
32
32
  end
33
33
 
34
34
  sig do
35
- abstract.returns(T::Hash[String, T.nilable(::Teams::Team)])
35
+ abstract.returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
36
36
  end
37
37
  def codeowners_lines_to_owners
38
38
  end
@@ -13,7 +13,7 @@ module CodeOwnership
13
13
 
14
14
  sig do
15
15
  override.params(file: String).
16
- returns(T.nilable(::Teams::Team))
16
+ returns(T.nilable(::CodeTeams::Team))
17
17
  end
18
18
  def map_file_to_owner(file)
19
19
  package = map_file_to_relevant_package(file)
@@ -26,7 +26,7 @@ module CodeOwnership
26
26
  sig do
27
27
  override.
28
28
  params(files: T::Array[String]).
29
- returns(T::Hash[String, T.nilable(::Teams::Team)])
29
+ returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
30
30
  end
31
31
  def map_files_to_owners(files) # rubocop:disable Lint/UnusedMethodArgument
32
32
  ParseJsPackages.all.each_with_object({}) do |package, res|
@@ -49,7 +49,7 @@ module CodeOwnership
49
49
  # subset of files, but rather we want code ownership for all files.
50
50
  #
51
51
  sig do
52
- override.returns(T::Hash[String, T.nilable(::Teams::Team)])
52
+ override.returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
53
53
  end
54
54
  def codeowners_lines_to_owners
55
55
  ParseJsPackages.all.each_with_object({}) do |package, res|
@@ -65,7 +65,7 @@ module CodeOwnership
65
65
  'Owner metadata key in package.json'
66
66
  end
67
67
 
68
- sig { params(package: ParseJsPackages::Package).returns(T.nilable(Teams::Team)) }
68
+ sig { params(package: ParseJsPackages::Package).returns(T.nilable(CodeTeams::Team)) }
69
69
  def owner_for_package(package)
70
70
  raw_owner_value = package.metadata['owner']
71
71
  return nil if !raw_owner_value
@@ -13,7 +13,7 @@ module CodeOwnership
13
13
 
14
14
  sig do
15
15
  override.params(file: String).
16
- returns(T.nilable(::Teams::Team))
16
+ returns(T.nilable(::CodeTeams::Team))
17
17
  end
18
18
  def map_file_to_owner(file)
19
19
  package = map_file_to_relevant_package(file)
@@ -26,7 +26,7 @@ module CodeOwnership
26
26
  sig do
27
27
  override.
28
28
  params(files: T::Array[String]).
29
- returns(T::Hash[String, T.nilable(::Teams::Team)])
29
+ returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
30
30
  end
31
31
  def map_files_to_owners(files) # rubocop:disable Lint/UnusedMethodArgument
32
32
  ParsePackwerk.all.each_with_object({}) do |package, res|
@@ -49,7 +49,7 @@ module CodeOwnership
49
49
  # subset of files, but rather we want code ownership for all files.
50
50
  #
51
51
  sig do
52
- override.returns(T::Hash[String, T.nilable(::Teams::Team)])
52
+ override.returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
53
53
  end
54
54
  def codeowners_lines_to_owners
55
55
  ParsePackwerk.all.each_with_object({}) do |package, res|
@@ -65,7 +65,7 @@ module CodeOwnership
65
65
  'Owner metadata key in package.yml'
66
66
  end
67
67
 
68
- sig { params(package: ParsePackwerk::Package).returns(T.nilable(Teams::Team)) }
68
+ sig { params(package: ParsePackwerk::Package).returns(T.nilable(CodeTeams::Team)) }
69
69
  def owner_for_package(package)
70
70
  raw_owner_value = package.metadata['owner']
71
71
  return nil if !raw_owner_value
@@ -9,20 +9,20 @@ module CodeOwnership
9
9
  extend T::Sig
10
10
  include Interface
11
11
 
12
- @@map_files_to_owners = T.let(@map_files_to_owners, T.nilable(T::Hash[String, T.nilable(::Teams::Team)])) # rubocop:disable Style/ClassVars
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
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(::Teams::Team)])) # 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
15
  @@codeowners_lines_to_owners = {} # rubocop:disable Style/ClassVars
16
16
 
17
17
  sig do
18
18
  override.
19
19
  params(files: T::Array[String]).
20
- returns(T::Hash[String, T.nilable(::Teams::Team)])
20
+ returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
21
21
  end
22
22
  def map_files_to_owners(files) # rubocop:disable Lint/UnusedMethodArgument
23
23
  return @@map_files_to_owners if @@map_files_to_owners&.keys && @@map_files_to_owners.keys.count > 0
24
24
 
25
- @@map_files_to_owners = Teams.all.each_with_object({}) do |team, map| # rubocop:disable Style/ClassVars
25
+ @@map_files_to_owners = CodeTeams.all.each_with_object({}) do |team, map| # rubocop:disable Style/ClassVars
26
26
  TeamPlugins::Ownership.for(team).owned_globs.each do |glob|
27
27
  Dir.glob(glob).each do |filename|
28
28
  map[filename] = team
@@ -33,19 +33,19 @@ module CodeOwnership
33
33
 
34
34
  sig do
35
35
  override.params(file: String).
36
- returns(T.nilable(::Teams::Team))
36
+ returns(T.nilable(::CodeTeams::Team))
37
37
  end
38
38
  def map_file_to_owner(file)
39
39
  map_files_to_owners([file])[file]
40
40
  end
41
41
 
42
42
  sig do
43
- override.returns(T::Hash[String, T.nilable(::Teams::Team)])
43
+ override.returns(T::Hash[String, T.nilable(::CodeTeams::Team)])
44
44
  end
45
45
  def codeowners_lines_to_owners
46
46
  return @@codeowners_lines_to_owners if @@codeowners_lines_to_owners&.keys && @@codeowners_lines_to_owners.keys.count > 0
47
47
 
48
- @@codeowners_lines_to_owners = Teams.all.each_with_object({}) do |team, map| # rubocop:disable Style/ClassVars
48
+ @@codeowners_lines_to_owners = CodeTeams.all.each_with_object({}) do |team, map| # rubocop:disable Style/ClassVars
49
49
  TeamPlugins::Ownership.for(team).owned_globs.each do |owned_glob|
50
50
  map[owned_glob] = team
51
51
  end
@@ -3,7 +3,7 @@
3
3
  module CodeOwnership
4
4
  module Private
5
5
  module TeamPlugins
6
- class Github < Teams::Plugin
6
+ class Github < CodeTeams::Plugin
7
7
  extend T::Sig
8
8
  extend T::Helpers
9
9
 
@@ -3,7 +3,7 @@
3
3
  module CodeOwnership
4
4
  module Private
5
5
  module TeamPlugins
6
- class Ownership < Teams::Plugin
6
+ class Ownership < CodeTeams::Plugin
7
7
  extend T::Sig
8
8
  extend T::Helpers
9
9
 
@@ -25,24 +25,66 @@ module CodeOwnership
25
25
  # https://help.github.com/en/articles/about-code-owners
26
26
  HEADER
27
27
 
28
- contents = [
29
- header,
28
+ expected_content_lines = [
29
+ *header.split("\n"),
30
+ nil, # For line between header and codeowners_file_lines
30
31
  *codeowners_file_lines,
31
32
  nil, # For end-of-file newline
32
- ].join("\n")
33
+ ]
34
+
35
+ expected_contents = expected_content_lines.join("\n")
36
+ actual_contents = codeowners_filepath.exist? ? codeowners_filepath.read : ""
37
+ actual_content_lines = actual_contents.split("\n")
33
38
 
34
- codeowners_up_to_date = codeowners_filepath.exist? && codeowners_filepath.read == contents
39
+ codeowners_up_to_date = actual_contents == expected_contents
35
40
 
36
41
  errors = T.let([], T::Array[String])
37
42
 
38
43
  if !codeowners_up_to_date
39
44
  if autocorrect
40
- codeowners_filepath.write(contents)
45
+ codeowners_filepath.write(expected_contents)
41
46
  if stage_changes
42
47
  `git add #{codeowners_filepath}`
43
48
  end
44
49
  else
45
- errors << "CODEOWNERS out of date. Ensure pre-commit hook is set up correctly and used. You can also run bin/codeownership validate to update the CODEOWNERS file\n"
50
+ # If there is no current file or its empty, display a shorter message.
51
+ missing_lines = expected_content_lines - actual_content_lines
52
+ extra_lines = actual_content_lines - expected_content_lines
53
+ missing_lines_text = if missing_lines.any?
54
+ <<~COMMENT
55
+ CODEOWNERS should contain the following lines, but does not:
56
+ #{(expected_content_lines - actual_content_lines).map { |line| "- \"#{line}\""}.join("\n")}
57
+ COMMENT
58
+ end
59
+
60
+ extra_lines_text = if extra_lines.any?
61
+ <<~COMMENT
62
+ CODEOWNERS should not contain the following lines, but it does:
63
+ #{(actual_content_lines - expected_content_lines).map { |line| "- \"#{line}\""}.join("\n")}
64
+ COMMENT
65
+ end
66
+
67
+ diff_text = if missing_lines_text && extra_lines_text
68
+ "#{missing_lines_text}\n#{extra_lines_text}".chomp
69
+ elsif missing_lines_text
70
+ missing_lines_text
71
+ elsif extra_lines_text
72
+ extra_lines_text
73
+ else
74
+ ""
75
+ end
76
+
77
+ if actual_contents == ""
78
+ errors << <<~CODEOWNERS_ERROR
79
+ CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
80
+ CODEOWNERS_ERROR
81
+ else
82
+ errors << <<~CODEOWNERS_ERROR
83
+ CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
84
+
85
+ #{diff_text.chomp}
86
+ CODEOWNERS_ERROR
87
+ end
46
88
  end
47
89
  end
48
90
 
@@ -56,7 +98,7 @@ module CodeOwnership
56
98
  # https://help.github.com/articles/about-codeowners/
57
99
  sig { returns(T::Array[String]) }
58
100
  def codeowners_file_lines
59
- github_team_map = Teams.all.each_with_object({}) do |team, map|
101
+ github_team_map = CodeTeams.all.each_with_object({}) do |team, map|
60
102
  team_github = TeamPlugins::Github.for(team).github
61
103
  next if team_github.do_not_add_to_codeowners_file
62
104
 
@@ -50,7 +50,7 @@ module CodeOwnership
50
50
  end
51
51
 
52
52
  if errors.any?
53
- errors << 'See https://github.com/bigrails/code_ownership#README.md for more details'
53
+ errors << 'See https://github.com/rubyatscale/code_ownership#README.md for more details'
54
54
  raise InvalidCodeOwnershipConfigurationError.new(errors.join("\n")) # rubocop:disable Style/RaiseArgs
55
55
  end
56
56
  end
@@ -92,11 +92,11 @@ module CodeOwnership
92
92
  @tracked_files ||= Dir.glob(configuration.owned_globs)
93
93
  end
94
94
 
95
- sig { params(team_name: String, location_of_reference: String).returns(Teams::Team) }
95
+ sig { params(team_name: String, location_of_reference: String).returns(CodeTeams::Team) }
96
96
  def self.find_team!(team_name, location_of_reference)
97
- found_team = Teams.find(team_name)
97
+ found_team = CodeTeams.find(team_name)
98
98
  if found_team.nil?
99
- raise StandardError, "Could not find team with name: `#{team_name}` in #{location_of_reference}. Make sure the team is one of `#{Teams.all.map(&:name).sort}`"
99
+ raise StandardError, "Could not find team with name: `#{team_name}` in #{location_of_reference}. Make sure the team is one of `#{CodeTeams.all.map(&:name).sort}`"
100
100
  else
101
101
  found_team
102
102
  end
@@ -3,7 +3,7 @@
3
3
  # typed: strict
4
4
 
5
5
  require 'set'
6
- require 'teams'
6
+ require 'code_teams'
7
7
  require 'sorbet-runtime'
8
8
  require 'json'
9
9
  require 'parse_packwerk'
@@ -17,15 +17,15 @@ module CodeOwnership
17
17
 
18
18
  requires_ancestor { Kernel }
19
19
 
20
- sig { params(file: String).returns(T.nilable(Teams::Team)) }
20
+ sig { params(file: String).returns(T.nilable(CodeTeams::Team)) }
21
21
  def for_file(file)
22
- @for_file ||= T.let(@for_file, T.nilable(T::Hash[String, T.nilable(Teams::Team)]))
22
+ @for_file ||= T.let(@for_file, T.nilable(T::Hash[String, T.nilable(CodeTeams::Team)]))
23
23
  @for_file ||= {}
24
24
 
25
25
  return nil if file.start_with?('./')
26
26
  return @for_file[file] if @for_file.key?(file)
27
27
 
28
- owner = T.let(nil, T.nilable(Teams::Team))
28
+ owner = T.let(nil, T.nilable(CodeTeams::Team))
29
29
 
30
30
  Private.mappers.each do |mapper|
31
31
  owner = mapper.map_file_to_owner(file)
@@ -61,7 +61,7 @@ module CodeOwnership
61
61
 
62
62
  # Given a backtrace from either `Exception#backtrace` or `caller`, find the
63
63
  # first line that corresponds to a file with assigned ownership
64
- sig { params(backtrace: T.nilable(T::Array[String]), excluded_teams: T::Array[::Teams::Team]).returns(T.nilable(::Teams::Team)) }
64
+ sig { params(backtrace: T.nilable(T::Array[String]), excluded_teams: T::Array[::CodeTeams::Team]).returns(T.nilable(::CodeTeams::Team)) }
65
65
  def for_backtrace(backtrace, excluded_teams: [])
66
66
  return unless backtrace
67
67
 
@@ -93,9 +93,9 @@ module CodeOwnership
93
93
  nil
94
94
  end
95
95
 
96
- sig { params(klass: T.nilable(T.any(Class, Module))).returns(T.nilable(::Teams::Team)) }
96
+ sig { params(klass: T.nilable(T.any(Class, Module))).returns(T.nilable(::CodeTeams::Team)) }
97
97
  def for_class(klass)
98
- @memoized_values ||= T.let(@memoized_values, T.nilable(T::Hash[String, T.nilable(::Teams::Team)]))
98
+ @memoized_values ||= T.let(@memoized_values, T.nilable(T::Hash[String, T.nilable(::CodeTeams::Team)]))
99
99
  @memoized_values ||= {}
100
100
  # We use key because the memoized value could be `nil`
101
101
  if !@memoized_values.key?(klass.to_s)
@@ -110,7 +110,7 @@ module CodeOwnership
110
110
  end
111
111
  end
112
112
 
113
- sig { params(package: ParsePackwerk::Package).returns(T.nilable(::Teams::Team)) }
113
+ sig { params(package: ParsePackwerk::Package).returns(T.nilable(::CodeTeams::Team)) }
114
114
  def for_package(package)
115
115
  Private::OwnershipMappers::PackageOwnership.new.owner_for_package(package)
116
116
  end
@@ -1,78 +1,78 @@
1
1
  # typed: true
2
2
 
3
3
  # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `bigrails-teams` gem.
5
- # Please instead update this file by running `bin/tapioca gem bigrails-teams`.
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
6
 
7
- module Teams
7
+ module CodeTeams
8
8
  class << self
9
- sig { returns(T::Array[::Teams::Team]) }
9
+ sig { returns(T::Array[::CodeTeams::Team]) }
10
10
  def all; end
11
11
 
12
12
  sig { void }
13
13
  def bust_caches!; end
14
14
 
15
- sig { params(name: ::String).returns(T.nilable(::Teams::Team)) }
15
+ sig { params(name: ::String).returns(T.nilable(::CodeTeams::Team)) }
16
16
  def find(name); end
17
17
 
18
- sig { params(dir: ::String).returns(T::Array[::Teams::Team]) }
18
+ sig { params(dir: ::String).returns(T::Array[::CodeTeams::Team]) }
19
19
  def for_directory(dir); end
20
20
 
21
21
  sig { params(string: ::String).returns(::String) }
22
22
  def tag_value_for(string); end
23
23
 
24
- sig { params(teams: T::Array[::Teams::Team]).returns(T::Array[::String]) }
24
+ sig { params(teams: T::Array[::CodeTeams::Team]).returns(T::Array[::String]) }
25
25
  def validation_errors(teams); end
26
26
  end
27
27
  end
28
28
 
29
- class Teams::IncorrectPublicApiUsageError < ::StandardError; end
29
+ class CodeTeams::IncorrectPublicApiUsageError < ::StandardError; end
30
30
 
31
- class Teams::Plugin
31
+ class CodeTeams::Plugin
32
32
  abstract!
33
33
 
34
- sig { params(team: ::Teams::Team).void }
34
+ sig { params(team: ::CodeTeams::Team).void }
35
35
  def initialize(team); end
36
36
 
37
37
  class << self
38
- sig { returns(T::Array[T.class_of(Teams::Plugin)]) }
38
+ sig { returns(T::Array[T.class_of(CodeTeams::Plugin)]) }
39
39
  def all_plugins; end
40
40
 
41
- sig { params(team: ::Teams::Team).returns(T.attached_class) }
41
+ sig { params(team: ::CodeTeams::Team).returns(T.attached_class) }
42
42
  def for(team); end
43
43
 
44
44
  sig { params(base: T.untyped).void }
45
45
  def inherited(base); end
46
46
 
47
- sig { params(team: ::Teams::Team, key: ::String).returns(::String) }
47
+ sig { params(team: ::CodeTeams::Team, key: ::String).returns(::String) }
48
48
  def missing_key_error_message(team, key); end
49
49
 
50
- sig { params(teams: T::Array[::Teams::Team]).returns(T::Array[::String]) }
50
+ sig { params(teams: T::Array[::CodeTeams::Team]).returns(T::Array[::String]) }
51
51
  def validation_errors(teams); end
52
52
 
53
53
  private
54
54
 
55
- sig { params(team: ::Teams::Team).returns(T.attached_class) }
55
+ sig { params(team: ::CodeTeams::Team).returns(T.attached_class) }
56
56
  def register_team(team); end
57
57
 
58
- sig { returns(T::Hash[T.nilable(::String), T::Hash[::Class, ::Teams::Plugin]]) }
58
+ sig { returns(T::Hash[T.nilable(::String), T::Hash[::Class, ::CodeTeams::Plugin]]) }
59
59
  def registry; end
60
60
  end
61
61
  end
62
62
 
63
- module Teams::Plugins; end
63
+ module CodeTeams::Plugins; end
64
64
 
65
- class Teams::Plugins::Identity < ::Teams::Plugin
66
- sig { returns(::Teams::Plugins::Identity::IdentityStruct) }
65
+ class CodeTeams::Plugins::Identity < ::CodeTeams::Plugin
66
+ sig { returns(::CodeTeams::Plugins::Identity::IdentityStruct) }
67
67
  def identity; end
68
68
 
69
69
  class << self
70
- sig { override.params(teams: T::Array[::Teams::Team]).returns(T::Array[::String]) }
70
+ sig { override.params(teams: T::Array[::CodeTeams::Team]).returns(T::Array[::String]) }
71
71
  def validation_errors(teams); end
72
72
  end
73
73
  end
74
74
 
75
- class Teams::Plugins::Identity::IdentityStruct < ::Struct
75
+ class CodeTeams::Plugins::Identity::IdentityStruct < ::Struct
76
76
  def name; end
77
77
  def name=(_); end
78
78
 
@@ -84,7 +84,7 @@ class Teams::Plugins::Identity::IdentityStruct < ::Struct
84
84
  end
85
85
  end
86
86
 
87
- class Teams::Team
87
+ class CodeTeams::Team
88
88
  sig { params(config_yml: T.nilable(::String), raw_hash: T::Hash[T.untyped, T.untyped]).void }
89
89
  def initialize(config_yml:, raw_hash:); end
90
90
 
@@ -109,12 +109,12 @@ class Teams::Team
109
109
  def to_tag; end
110
110
 
111
111
  class << self
112
- sig { params(raw_hash: T::Hash[T.untyped, T.untyped]).returns(::Teams::Team) }
112
+ sig { params(raw_hash: T::Hash[T.untyped, T.untyped]).returns(::CodeTeams::Team) }
113
113
  def from_hash(raw_hash); end
114
114
 
115
- sig { params(config_yml: ::String).returns(::Teams::Team) }
115
+ sig { params(config_yml: ::String).returns(::CodeTeams::Team) }
116
116
  def from_yml(config_yml); end
117
117
  end
118
118
  end
119
119
 
120
- Teams::UNKNOWN_TEAM_STRING = T.let(T.unsafe(nil), String)
120
+ CodeTeams::UNKNOWN_TEAM_STRING = T.let(T.unsafe(nil), String)
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_ownership
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.25.0
4
+ version: 1.28.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: 2022-05-28 00:00:00.000000000 Z
11
+ date: 2022-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bigrails-teams
14
+ name: code_teams
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: parse_packwerk
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -149,17 +149,17 @@ files:
149
149
  - lib/code_ownership/private/validations/github_codeowners_up_to_date.rb
150
150
  - lib/code_ownership/private/validations/interface.rb
151
151
  - sorbet/config
152
- - sorbet/rbi/gems/bigrails-teams@0.1.0.rbi
152
+ - sorbet/rbi/gems/code_teams@1.0.0.rbi
153
153
  - sorbet/rbi/gems/parse_packwerk@0.7.0.rbi
154
154
  - sorbet/rbi/manual.rbi
155
155
  - sorbet/rbi/todo.rbi
156
- homepage: https://github.com/bigrails/code_ownership
156
+ homepage: https://github.com/rubyatscale/code_ownership
157
157
  licenses:
158
158
  - MIT
159
159
  metadata:
160
- homepage_uri: https://github.com/bigrails/code_ownership
161
- source_code_uri: https://github.com/bigrails/code_ownership
162
- changelog_uri: https://github.com/bigrails/code_ownership/releases
160
+ homepage_uri: https://github.com/rubyatscale/code_ownership
161
+ source_code_uri: https://github.com/rubyatscale/code_ownership
162
+ changelog_uri: https://github.com/rubyatscale/code_ownership/releases
163
163
  allowed_push_host: https://rubygems.org
164
164
  post_install_message:
165
165
  rdoc_options: []