@@ -36,7 +36,7 @@ pub struct Errors(Vec<Error>);
3636
3737impl Validator {
3838 #[ instrument( level = "debug" , skip_all) ]
39- pub fn validate ( & self , skip_codeowners_file_validation : bool ) -> Result < ( ) , Errors > {
39+ pub fn validate ( & self ) -> Result < ( ) , Errors > {
4040 let mut validation_errors = Vec :: new ( ) ;
4141
4242 debug ! ( "validate_invalid_team" ) ;
@@ -45,10 +45,8 @@ impl Validator {
4545 debug ! ( "validate_file_ownership" ) ;
4646 validation_errors. append ( & mut self . validate_file_ownership ( ) ) ;
4747
48- if !skip_codeowners_file_validation {
49- debug ! ( "validate_codeowners_file" ) ;
50- validation_errors. append ( & mut self . validate_codeowners_file ( ) ) ;
51- }
48+ debug ! ( "validate_codeowners_file" ) ;
49+ validation_errors. append ( & mut self . validate_codeowners_file ( ) ) ;
5250
5351 if validation_errors. is_empty ( ) {
5452 Ok ( ( ) )
@@ -129,10 +127,15 @@ impl Validator {
129127 fn validate_codeowners_file ( & self ) -> Vec < Error > {
130128 let generated_file = self . file_generator . generate_file ( ) ;
131129
132- if generated_file != self . project . codeowners_file {
133- vec ! [ Error :: CodeownershipFileIsStale ]
134- } else {
135- vec ! [ ]
130+ match self . project . get_codeowners_file ( ) {
131+ Ok ( current_file) => {
132+ if generated_file != current_file {
133+ vec ! [ Error :: CodeownershipFileIsStale ]
134+ } else {
135+ vec ! [ ]
136+ }
137+ }
138+ Err ( _) => vec ! [ Error :: CodeownershipFileIsStale ] , // Treat any read error as stale file
136139 }
137140 }
138141
0 commit comments