@@ -43,27 +43,23 @@ def for_file(file)
4343
4444 sig { params ( team : T . any ( CodeTeams ::Team , String ) ) . returns ( String ) }
4545 def for_team ( team )
46- Private . load_configuration!
47-
4846 team = T . must ( CodeTeams . find ( team ) ) if team . is_a? ( String )
4947 ownership_information = T . let ( [ ] , T ::Array [ String ] )
5048
5149 ownership_information << "# Code Ownership Report for `#{ team . name } ` Team"
52- Mapper . all . each do | mapper |
53- ownership_information << "## #{ mapper . description } "
54- codeowners_lines = mapper . globs_to_owner ( Private . tracked_files )
50+
51+ Private . glob_cache . raw_cache_contents . each do | mapper_description , glob_to_owning_team_map |
52+ ownership_information << "## #{ mapper_description } "
5553 ownership_for_mapper = [ ]
56- codeowners_lines . each do |line , team_for_line |
57- next if team_for_line . nil?
58- if team_for_line . name == team . name
59- ownership_for_mapper << "- #{ line } "
60- end
54+ glob_to_owning_team_map . each do |glob , owning_team |
55+ next if owning_team != team
56+ ownership_for_mapper << "- #{ glob } "
6157 end
6258
6359 if ownership_for_mapper . empty?
6460 ownership_information << 'This team owns nothing in this category.'
6561 else
66- ownership_information += ownership_for_mapper
62+ ownership_information += ownership_for_mapper . sort
6763 end
6864
6965 ownership_information << ""
0 commit comments