Skip to content

Commit cc6316c

Browse files
committed
update the way we glob team files
1 parent 39bed6a commit cc6316c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/code_ownership/private/ownership_mappers/team_globs.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@ def map_files_to_owners
2020
return @@map_files_to_owners if @@map_files_to_owners&.keys && @@map_files_to_owners.keys.count.positive?
2121

2222
@@map_files_to_owners = CodeTeams.all.each_with_object({}) do |team, map| # rubocop:disable Style/ClassVars
23-
TeamPlugins::Ownership.for(team).owned_globs.each do |glob|
24-
Dir.glob(glob).each do |filename|
25-
map[filename] = team
26-
end
23+
code_team = TeamPlugins::Ownership.for(team)
24+
25+
Dir.glob(code_team.owned_globs).each do |filename|
26+
map[filename] = team
2727
end
2828

29-
# Remove anything that is unowned
30-
TeamPlugins::Ownership.for(team).unowned_globs.each do |glob|
31-
Dir.glob(glob).each do |filename|
32-
map.delete(filename)
33-
end
29+
# Remove anything that is unowned by this team
30+
Dir.glob(code_team.unowned_globs).each do |filename|
31+
map.delete(filename)
3432
end
3533
end
3634
end
@@ -69,6 +67,7 @@ def find_overlapping_globs
6967
T.must(mapped_files[filename]) << MappingContext.new(glob: glob, team: team)
7068
end
7169
end
70+
7271
# Remove anything that is unowned
7372
TeamPlugins::Ownership.for(team).unowned_globs.each do |glob|
7473
Dir.glob(glob).each do |filename|

0 commit comments

Comments
 (0)