File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -114,13 +114,13 @@ fn cli() -> Result<(), Error> {
114114 let ownership = Ownership :: build ( Project :: build ( & project_root, & codeowners_file_path, & config) . change_context ( Error :: Io ) ?) ;
115115
116116 match args. command {
117- Command :: Validate => ownership. validate ( ) . change_context ( Error :: ValidationFailed ) ?,
117+ Command :: Validate => ownership. validate ( false ) . change_context ( Error :: ValidationFailed ) ?,
118118 Command :: Generate => {
119119 std:: fs:: write ( codeowners_file_path, ownership. generate_file ( ) ) . change_context ( Error :: Io ) ?;
120120 }
121121 Command :: GenerateAndValidate => {
122122 std:: fs:: write ( codeowners_file_path, ownership. generate_file ( ) ) . change_context ( Error :: Io ) ?;
123- ownership. validate ( ) . change_context ( Error :: ValidationFailed ) ?
123+ ownership. validate ( true ) . change_context ( Error :: ValidationFailed ) ?
124124 }
125125 Command :: ForFile { name } => {
126126 let file_owners = ownership. for_file ( & name) . change_context ( Error :: Io ) ?;
Original file line number Diff line number Diff line change @@ -86,15 +86,15 @@ impl Ownership {
8686 }
8787
8888 #[ instrument( level = "debug" , skip_all) ]
89- pub fn validate ( & self ) -> Result < ( ) , ValidatorErrors > {
89+ pub fn validate ( & self , skip_codeowners_file_validation : bool ) -> Result < ( ) , ValidatorErrors > {
9090 info ! ( "validating file ownership" ) ;
9191 let validator = Validator {
9292 project : self . project . clone ( ) ,
9393 mappers : self . mappers ( ) ,
9494 file_generator : FileGenerator { mappers : self . mappers ( ) } ,
9595 } ;
9696
97- validator. validate ( )
97+ validator. validate ( skip_codeowners_file_validation )
9898 }
9999
100100 #[ instrument( level = "debug" , skip_all) ]
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ pub struct Errors(Vec<Error>);
3636
3737impl Validator {
3838 #[ instrument( level = "debug" , skip_all) ]
39- pub fn validate ( & self ) -> Result < ( ) , Errors > {
39+ pub fn validate ( & self , skip_codeowners_file_validation : bool ) -> Result < ( ) , Errors > {
4040 let mut validation_errors = Vec :: new ( ) ;
4141
4242 debug ! ( "validate_invalid_team" ) ;
@@ -45,8 +45,10 @@ impl Validator {
4545 debug ! ( "validate_file_ownership" ) ;
4646 validation_errors. append ( & mut self . validate_file_ownership ( ) ) ;
4747
48- debug ! ( "validate_codeowners_file" ) ;
49- validation_errors. append ( & mut self . validate_codeowners_file ( ) ) ;
48+ if !skip_codeowners_file_validation {
49+ debug ! ( "validate_codeowners_file" ) ;
50+ validation_errors. append ( & mut self . validate_codeowners_file ( ) ) ;
51+ }
5052
5153 if validation_errors. is_empty ( ) {
5254 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments