@@ -14,7 +14,10 @@ mod file_owner_finder;
1414pub ( crate ) mod mapper;
1515mod validator;
1616
17- use crate :: { ownership:: mapper:: DirectoryMapper , project:: Project } ;
17+ use crate :: {
18+ ownership:: mapper:: DirectoryMapper ,
19+ project:: { Project , Team } ,
20+ } ;
1821
1922pub use validator:: Errors as ValidatorErrors ;
2023
@@ -29,7 +32,7 @@ pub struct Ownership {
2932}
3033
3134pub struct FileOwner {
32- pub team_name : TeamName ,
35+ pub team : Team ,
3336 pub team_config_file_path : String ,
3437 pub sources : Vec < Source > ,
3538}
@@ -64,17 +67,21 @@ impl Display for FileOwner {
6467
6568 write ! (
6669 f,
67- "Team: {}\n Team YML: {}\n Description:\n - {}" ,
68- self . team_name , self . team_config_file_path, sources
70+ "Team: {}\n Github Team: {} \ n Team YML: {}\n Description:\n - {}" ,
71+ self . team . name , self . team . github_team , self . team_config_file_path, sources
6972 )
7073 }
7174}
7275
7376impl Default for FileOwner {
7477 fn default ( ) -> Self {
7578 Self {
76- team_name : "Unowned" . to_string ( ) ,
77- team_config_file_path : "Unowned" . to_string ( ) ,
79+ team : Team {
80+ name : "Unowned" . to_string ( ) ,
81+ github_team : "Unowned" . to_string ( ) ,
82+ ..Default :: default ( )
83+ } ,
84+ team_config_file_path : "" . to_string ( ) ,
7885 sources : vec ! [ ] ,
7986 }
8087 }
@@ -132,7 +139,7 @@ impl Ownership {
132139 . sorted_by_key ( |owner| owner. team_name . to_lowercase ( ) )
133140 . map ( |owner| match self . project . get_team ( & owner. team_name ) {
134141 Some ( team) => FileOwner {
135- team_name : owner . team_name . clone ( ) ,
142+ team : team . clone ( ) ,
136143 team_config_file_path : team
137144 . path
138145 . strip_prefix ( & self . project . base_path )
@@ -220,7 +227,7 @@ mod tests {
220227 let ownership = build_ownership_with_all_mappers ( ) ?;
221228 let file_owners = ownership. for_file ( "app/consumers/directory_owned.rb" ) . unwrap ( ) ;
222229 assert_eq ! ( file_owners. len( ) , 1 ) ;
223- assert_eq ! ( file_owners[ 0 ] . team_name , "Bar" ) ;
230+ assert_eq ! ( file_owners[ 0 ] . team . name , "Bar" ) ;
224231 assert_eq ! ( file_owners[ 0 ] . team_config_file_path, "config/teams/bar.yml" ) ;
225232 Ok ( ( ) )
226233 }
0 commit comments