@@ -36,37 +36,8 @@ pub struct Runner {
3636 cache : Cache ,
3737}
3838
39- pub fn for_file ( run_config : & RunConfig , file_path : & str , fast : bool ) -> RunResult {
40- if fast {
41- for_file_from_codeowners ( run_config, file_path)
42- } else {
43- //run_with_runner(run_config, |runner| runner.for_file(file_path))
44- for_file_optimized ( run_config, file_path)
45- }
46- }
47-
48- fn for_file_from_codeowners ( run_config : & RunConfig , file_path : & str ) -> RunResult {
49- match team_for_file_from_codeowners ( run_config, file_path) {
50- Ok ( Some ( team) ) => {
51- let relative_team_yml_path = team. path . strip_prefix ( & run_config. project_root ) . unwrap_or ( & team. path ) ;
52-
53- RunResult {
54- info_messages : vec ! [
55- format!( "Team: {}" , team. name) ,
56- format!( "Team YML: {}" , relative_team_yml_path. display( ) ) ,
57- ] ,
58- ..Default :: default ( )
59- }
60- }
61- Ok ( None ) => RunResult {
62- info_messages : vec ! [ "Team: Unowned" . to_string( ) , "Team YML:" . to_string( ) ] ,
63- ..Default :: default ( )
64- } ,
65- Err ( err) => RunResult {
66- io_errors : vec ! [ err. to_string( ) ] ,
67- ..Default :: default ( )
68- } ,
69- }
39+ pub fn for_file ( run_config : & RunConfig , file_path : & str ) -> RunResult {
40+ for_file_optimized ( run_config, file_path)
7041}
7142
7243pub fn team_for_file_from_codeowners ( run_config : & RunConfig , file_path : & str ) -> Result < Option < Team > , Error > {
@@ -289,41 +260,6 @@ impl Runner {
289260 . output ( ) ;
290261 }
291262
292- // TODO: remove this once we've verified the fast path is working
293- #[ allow( dead_code) ]
294- pub fn for_file ( & self , file_path : & str ) -> RunResult {
295- let relative_file_path = Path :: new ( file_path)
296- . strip_prefix ( & self . run_config . project_root )
297- . unwrap_or ( Path :: new ( file_path) ) ;
298- let file_owners = match self . ownership . for_file ( relative_file_path) {
299- Ok ( file_owners) => file_owners,
300- Err ( err) => {
301- return RunResult {
302- io_errors : vec ! [ err. to_string( ) ] ,
303- ..Default :: default ( )
304- } ;
305- }
306- } ;
307- let info_messages: Vec < String > = match file_owners. len ( ) {
308- 0 => vec ! [ format!( "{}" , FileOwner :: default ( ) ) ] ,
309- 1 => vec ! [ format!( "{}" , file_owners[ 0 ] ) ] ,
310- _ => {
311- let mut error_messages = vec ! [ "Error: file is owned by multiple teams!" . to_string( ) ] ;
312- for file_owner in file_owners {
313- error_messages. push ( format ! ( "\n {}" , file_owner) ) ;
314- }
315- return RunResult {
316- validation_errors : error_messages,
317- ..Default :: default ( )
318- } ;
319- }
320- } ;
321- RunResult {
322- info_messages,
323- ..Default :: default ( )
324- }
325- }
326-
327263 pub fn for_team ( & self , team_name : & str ) -> RunResult {
328264 let mut info_messages = vec ! [ ] ;
329265 let mut io_errors = vec ! [ ] ;
0 commit comments