From 0f4d47d246ed8a0f8313ae9754b5c241e86f6f7d Mon Sep 17 00:00:00 2001 From: Jose Miguel Colella Date: Thu, 29 Jan 2026 14:07:25 -0800 Subject: [PATCH] fix: Update error message to correctly reflect command --- README.md | 2 +- src/ownership/codeowners_file_parser.rs | 6 +++--- src/ownership/validator.rs | 2 +- tests/executable_name_config_test.rs | 4 ++-- tests/invalid_project_test.rs | 2 +- tests/run_config_executable_override_test.rs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8b1c910..7612fce 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ codeowners for-team Payroll #### Generate but do not stage the file ```sh -codeowners generate --skip-stage +codeownership validate --skip-stage ``` #### Run without using the cache diff --git a/src/ownership/codeowners_file_parser.rs b/src/ownership/codeowners_file_parser.rs index c40410c..c98e99b 100644 --- a/src/ownership/codeowners_file_parser.rs +++ b/src/ownership/codeowners_file_parser.rs @@ -180,7 +180,7 @@ pub fn parse_for_team(team_name: String, codeowners_file: &str) -> Result = None; let input: String = codeowners_file.replace(&FileGenerator::disclaimer().join("\n"), ""); - let error_message = "CODEOWNERS out of date. Run `codeowners generate` to update the CODEOWNERS file"; + let error_message = "CODEOWNERS out of date. Run `codeownership validate` to update the CODEOWNERS file"; for line in input.trim_start().lines() { match line { @@ -345,7 +345,7 @@ mod tests { let team_ownership = parse_for_team("@Foo".to_string(), codeownership_file); assert!( team_ownership - .is_err_and(|e| e.to_string() == "CODEOWNERS out of date. Run `codeowners generate` to update the CODEOWNERS file") + .is_err_and(|e| e.to_string() == "CODEOWNERS out of date. Run `codeownership validate` to update the CODEOWNERS file") ); Ok(()) } @@ -360,7 +360,7 @@ mod tests { let team_ownership = parse_for_team("@Foo".to_string(), codeownership_file); assert!( team_ownership - .is_err_and(|e| e.to_string() == "CODEOWNERS out of date. Run `codeowners generate` to update the CODEOWNERS file") + .is_err_and(|e| e.to_string() == "CODEOWNERS out of date. Run `codeownership validate` to update the CODEOWNERS file") ); Ok(()) } diff --git a/src/ownership/validator.rs b/src/ownership/validator.rs index 627c85c..4b38946 100644 --- a/src/ownership/validator.rs +++ b/src/ownership/validator.rs @@ -169,7 +169,7 @@ impl Error { Error::FileWithoutOwner { path: _ } => "Some files are missing ownership".to_owned(), Error::FileWithMultipleOwners { path: _, owners: _ } => "Code ownership should only be defined for each file in one way. The following files have declared ownership in multiple ways".to_owned(), Error::CodeownershipFileIsStale { executable_name } => { - format!("CODEOWNERS out of date. Run `{} generate` to update the CODEOWNERS file", executable_name) + format!("CODEOWNERS out of date. Run `bin/{} validate` to update the CODEOWNERS file", executable_name) } Error::InvalidTeam { name: _, path: _ } => "Found invalid team annotations".to_owned(), } diff --git a/tests/executable_name_config_test.rs b/tests/executable_name_config_test.rs index 0b0eb6e..105723f 100644 --- a/tests/executable_name_config_test.rs +++ b/tests/executable_name_config_test.rs @@ -27,7 +27,7 @@ fn test_validate_with_default_executable_name() -> Result<(), Box> { &["validate"], false, OutputStream::Stdout, - predicate::str::contains("Run `codeowners generate`"), + predicate::str::contains("Run `codeownership validate`"), )?; Ok(()) } @@ -59,7 +59,7 @@ fn test_default_executable_name_full_error_message() -> Result<(), Box Result<(), Box> { OutputStream::Stdout, predicate::eq(indoc! {" - CODEOWNERS out of date. Run `codeowners generate` to update the CODEOWNERS file + CODEOWNERS out of date. Run `codeownership validate` to update the CODEOWNERS file Code ownership should only be defined for each file in one way. The following files have declared ownership in multiple ways diff --git a/tests/run_config_executable_override_test.rs b/tests/run_config_executable_override_test.rs index 35e1c4b..ff3d0de 100644 --- a/tests/run_config_executable_override_test.rs +++ b/tests/run_config_executable_override_test.rs @@ -91,7 +91,7 @@ fn test_run_config_executable_path_overrides_default() -> Result<(), Box