diff --git a/src/config.rs b/src/config.rs index 5282aa3..620185f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -68,7 +68,7 @@ fn vendored_gems_path() -> String { } fn default_executable_name() -> String { - "codeowners".to_string() + "codeowners generate".to_string() } fn default_ignore_dirs() -> Vec { @@ -134,7 +134,7 @@ mod tests { vec!["frontend/**/node_modules/**/*", "frontend/**/__generated__/**/*"] ); assert_eq!(config.vendored_gems_path, "vendored/"); - assert_eq!(config.executable_name, "codeowners"); + assert_eq!(config.executable_name, "codeowners generate"); Ok(()) } @@ -167,7 +167,7 @@ mod tests { fs::write(&config_path, config_str)?; let config_file = File::open(&config_path)?; let config: Config = serde_yaml::from_reader(config_file)?; - assert_eq!(config.executable_name, "codeowners"); + assert_eq!(config.executable_name, "codeowners generate"); Ok(()) } diff --git a/src/ownership/validator.rs b/src/ownership/validator.rs index 627c85c..16916c5 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 `{}` to update the CODEOWNERS file", executable_name) } Error::InvalidTeam { name: _, path: _ } => "Found invalid team annotations".to_owned(), } diff --git a/src/project.rs b/src/project.rs index 8293103..2d9cb71 100644 --- a/src/project.rs +++ b/src/project.rs @@ -221,7 +221,7 @@ mod tests { codeowners_file_path: PathBuf::from(".github/CODEOWNERS"), directory_codeowner_files: vec![], teams_by_name: HashMap::new(), - executable_name: "codeowners".to_string(), + executable_name: "codeowners generate".to_string(), }; let map = project.vendored_gem_by_name(); diff --git a/tests/executable_name_config_test.rs b/tests/executable_name_config_test.rs index 0b0eb6e..5832eb8 100644 --- a/tests/executable_name_config_test.rs +++ b/tests/executable_name_config_test.rs @@ -14,7 +14,7 @@ fn test_validate_with_custom_executable_name() -> Result<(), Box> { &["validate"], false, OutputStream::Stdout, - predicate::str::contains("Run `bin/codeownership generate`"), + predicate::str::contains("Run `bin/codeownership validate`"), )?; Ok(()) } @@ -42,7 +42,7 @@ fn test_custom_executable_name_full_error_message() -> Result<(), Box OutputStream::Stdout, predicate::eq(indoc! {" - CODEOWNERS out of date. Run `bin/codeownership generate` to update the CODEOWNERS file + CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file "}), )?; diff --git a/tests/fixtures/custom_executable_name/config/code_ownership.yml b/tests/fixtures/custom_executable_name/config/code_ownership.yml index fa25a7d..3980def 100644 --- a/tests/fixtures/custom_executable_name/config/code_ownership.yml +++ b/tests/fixtures/custom_executable_name/config/code_ownership.yml @@ -1,4 +1,4 @@ --- owned_globs: - "{app,config}/**/*.rb" -executable_name: "bin/codeownership" +executable_name: "bin/codeownership validate" diff --git a/tests/run_config_executable_override_test.rs b/tests/run_config_executable_override_test.rs index 35e1c4b..29074b5 100644 --- a/tests/run_config_executable_override_test.rs +++ b/tests/run_config_executable_override_test.rs @@ -13,21 +13,20 @@ fn test_run_config_executable_path_overrides_config_file() -> Result<(), Box Result<(), Box< let project_path = temp_dir.path(); git_add_all_files(project_path); - // This fixture has executable_name: "bin/codeownership" in config + // This fixture has executable_name: "bin/codeownership validate" in config let mut run_config = build_run_config(project_path, ".github/CODEOWNERS"); run_config.executable_name = None; // Explicitly no override let result = validate(&run_config, vec![]); - // Should use "bin/codeownership" from config file + // Should use "bin/codeownership validate" from config file assert!(!result.validation_errors.is_empty(), "Expected validation errors but got none"); let error_msg = result.validation_errors.join("\n"); assert!( - error_msg.contains("Run `bin/codeownership generate`"), - "Expected error to contain 'bin/codeownership generate' but got: {}", + error_msg.contains("Run `bin/codeownership validate`"), + "Expected error to contain 'bin/codeownership validate' but got: {}", error_msg ); @@ -75,14 +74,14 @@ fn test_run_config_executable_path_overrides_default() -> Result<(), Box