code_ownership 1.32.5 → 1.32.7

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: 18268f7457aeb632f100ea698349530dc29a4be7ae62611f416fe43782705a5b
4
- data.tar.gz: 937353d0f07b1ff21ddf813dff047e59d4029c8ff6b08a29f75f31db61e342bb
3
+ metadata.gz: 76d700471a2e895926f184939c856b08ac75d5240a0d924a8e4474ac733a7204
4
+ data.tar.gz: 3b62947009df98089b522614022643762c4c51d82af4f90f957606bcedfe60bc
5
5
  SHA512:
6
- metadata.gz: 33c6f36e7a037a8495a370b738715cc2eb557912d4cb2f14df9184b329a6cc18e2c8e0a3f56fc0afd86d028ea321c2737043b8f94a88e5b3ea7c3486ff026216
7
- data.tar.gz: 1665092ef4a69c4eecd08039fa1315be6bca38aaec17ead77573ede1c408c4b1e4a9c5a1746505310abaebe07f14c95cb088b691d71ee66b35eaa84ef40db8bd
6
+ metadata.gz: df833467c3721e6b7d67aebd0732d59c46073589210251bd0859cb05979103741876264dd336df10401005360bca7a2937c65e861044b22abd698a2b8b65a20d
7
+ data.tar.gz: 1b8f489aa18295cd8c534f3d5bcb3e2ab569553f26ec7e5a9445faff90da3aee3860bd3d7a02d6e91b80815d65b96680b0f54b085770ba85a54efa13aa0109b1
@@ -56,14 +56,15 @@ module CodeOwnership
56
56
  ownership_map_cache.each do |path, code_team|
57
57
  team_mapping = github_team_map[code_team.name]
58
58
  next if team_mapping.nil?
59
- next if ignored_teams.include?(code_team.name)
60
- entry = "/#{path} #{team_mapping}"
61
- # In order to use the codeowners file as a proper cache, we'll need to insert commented out entries for ignored teams
62
- # entry = if ignored_teams.include?(code_team.name)
63
- # "# /#{path} #{team_mapping}"
64
- # else
65
- # "/#{path} #{team_mapping}"
66
- # end
59
+
60
+ # Leaving a commented out entry has two major benefits:
61
+ # 1) It allows the CODEOWNERS file to be used as a cache for validations
62
+ # 2) It allows users to specifically see what their team will not be notified about.
63
+ entry = if ignored_teams.include?(code_team.name)
64
+ "# /#{path} #{team_mapping}"
65
+ else
66
+ "/#{path} #{team_mapping}"
67
+ end
67
68
  ownership_entries << entry
68
69
  end
69
70
 
@@ -10,22 +10,19 @@ module CodeOwnership
10
10
 
11
11
  sig { override.params(files: T::Array[String], autocorrect: T::Boolean, stage_changes: T::Boolean).returns(T::Array[String]) }
12
12
  def validation_errors(files:, autocorrect: true, stage_changes: true)
13
- allow_list = Dir.glob(Private.configuration.unowned_globs)
14
13
  files_by_mapper = Private.glob_cache.files_by_mapper
15
14
 
16
15
  files_not_mapped_at_all = files.select do |file|
17
16
  files_by_mapper.fetch(file, []).count == 0
18
17
  end
19
18
 
20
- files_without_owners = files_not_mapped_at_all - allow_list
21
-
22
19
  errors = T.let([], T::Array[String])
23
20
 
24
- if files_without_owners.any?
21
+ if files_not_mapped_at_all.any?
25
22
  errors << <<~MSG
26
23
  Some files are missing ownership:
27
24
 
28
- #{files_without_owners.map { |file| "- #{file}" }.join("\n")}
25
+ #{files_not_mapped_at_all.map { |file| "- #{file}" }.join("\n")}
29
26
  MSG
30
27
  end
31
28
 
@@ -76,7 +76,7 @@ module CodeOwnership
76
76
  sig { returns(T::Array[String]) }
77
77
  def self.tracked_files
78
78
  @tracked_files ||= T.let(@tracked_files, T.nilable(T::Array[String]))
79
- @tracked_files ||= Dir.glob(configuration.owned_globs)
79
+ @tracked_files ||= Dir.glob(configuration.owned_globs) - Dir.glob(configuration.unowned_globs)
80
80
  end
81
81
 
82
82
  sig { params(team_name: String, location_of_reference: String).returns(CodeTeams::Team) }
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.32.5
4
+ version: 1.32.7
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-04-10 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: code_teams