From 3f2a59f4af5eaf8eff9c8d6844b8b99bc34725ed Mon Sep 17 00:00:00 2001 From: jlanson Date: Thu, 14 Nov 2024 12:00:59 -0500 Subject: [PATCH] chore: rename typo-file-path and orgs-file-path --- config/Hipcheck.kdl | 4 ++-- plugins/affiliation/src/main.rs | 8 ++++---- plugins/typo/src/main.rs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config/Hipcheck.kdl b/config/Hipcheck.kdl index e778a200..126d5851 100644 --- a/config/Hipcheck.kdl +++ b/config/Hipcheck.kdl @@ -29,13 +29,13 @@ analyze { category "attacks" { analysis "mitre/typo" { - typo-file-path "./config/Typos.toml" + typo-file "./config/Typos.toml" count-threshold 0 } category "commit" { analysis "mitre/affiliation" { - orgs-file-path "./plugins/affiliation/test/example_orgs.kdl" + orgs-file "./plugins/affiliation/test/example_orgs.kdl" count-threshold 0 } diff --git a/plugins/affiliation/src/main.rs b/plugins/affiliation/src/main.rs index 224f290a..73f60cc9 100644 --- a/plugins/affiliation/src/main.rs +++ b/plugins/affiliation/src/main.rs @@ -38,7 +38,7 @@ struct Config { #[derive(Debug, Deserialize)] struct RawConfig { - #[serde(rename = "orgs-file-path")] + #[serde(rename = "orgs-file")] orgs_file_path: Option, #[serde(rename = "count-threshold")] count_threshold: Option, @@ -51,14 +51,14 @@ impl TryFrom for Config { // Get the Orgs file path and confirm it exists let orgs_file = PathBuf::from(&ofv); file::exists(&orgs_file).map_err(|_e| ConfigError::InvalidConfigValue { - field_name: "orgs_file_path".to_owned(), + field_name: "orgs-file".to_owned(), value: ofv.clone(), reason: "could not find an orgs file with that name".to_owned(), })?; // Parse the Orgs file and construct an OrgSpec. let orgs_spec = OrgSpec::load_from(&orgs_file).map_err(|e| ConfigError::InvalidConfigValue { - field_name: "orgs_file_path".to_owned(), + field_name: "orgs-file".to_owned(), value: ofv.clone(), reason: format!("Failed to load org spec: {}", e), })?; @@ -68,7 +68,7 @@ impl TryFrom for Config { }) } else { Err(ConfigError::MissingRequiredConfig { - field_name: "orgs_file_path".to_owned(), + field_name: "orgs-file".to_owned(), field_type: "string".to_owned(), possible_values: vec![], }) diff --git a/plugins/typo/src/main.rs b/plugins/typo/src/main.rs index 8a5f355a..245f744b 100644 --- a/plugins/typo/src/main.rs +++ b/plugins/typo/src/main.rs @@ -21,7 +21,7 @@ pub static TYPOFILE: OnceLock = OnceLock::new(); #[derive(Deserialize)] struct RawConfig { - #[serde(rename = "typo-file-path")] + #[serde(rename = "typo-file")] typo_file_path: Option, #[serde(rename = "count-threshold")] count_threshold: Option, @@ -38,7 +38,7 @@ impl TryFrom for Config { // Get path to typo TOML file let Some(raw_typo_path) = value.typo_file_path else { return Err(ConfigError::MissingRequiredConfig { - field_name: "typo_file_path".to_owned(), + field_name: "typo-file".to_owned(), field_type: "string".to_owned(), possible_values: vec![], }); @@ -48,7 +48,7 @@ impl TryFrom for Config { let typo_file = TypoFile::load_from(&typo_path).map_err(|e| { log::error!("failed to load typo file: {}", e); ConfigError::InvalidConfigValue { - field_name: "typo_file_path".to_owned(), + field_name: "typo-file".to_owned(), value: "string".to_owned(), reason: format!("failed to load typo file: {}", e), }