diff --git a/apps/cargo-scout-audit/tests/integration_tests/detectors.rs b/apps/cargo-scout-audit/tests/integration_tests/detectors.rs index 9b4842be..a3f8e616 100644 --- a/apps/cargo-scout-audit/tests/integration_tests/detectors.rs +++ b/apps/cargo-scout-audit/tests/integration_tests/detectors.rs @@ -44,7 +44,8 @@ fn test() { vec![false; integration_tests_to_run.as_ref().map_or(0, |v| v.len())]; // Get the configuration - let detectors_config = Configuration::build().expect(&"Failed to get the configuration".red()); + let detectors_config = Configuration::build() + .unwrap_or_else(|_| panic!("{}", "Failed to get the configuration".red().to_string())); // Run all integration tests for detector_config in detectors_config.detectors.iter() { @@ -64,15 +65,10 @@ fn test() { println!("\n{} {}", "Testing detector:".bright_cyan(), detector_name); for example in detector_config.testcases.iter() { if let Some(vulnerable_path) = &example.vulnerable_path { - execute_and_validate_testcase(&detector_name, lint_message, &vulnerable_path, true); + execute_and_validate_testcase(&detector_name, lint_message, vulnerable_path, true); } if let Some(remediated_path) = &example.remediated_path { - execute_and_validate_testcase( - &detector_name, - lint_message, - &remediated_path, - false, - ); + execute_and_validate_testcase(&detector_name, lint_message, remediated_path, false); } } } diff --git a/apps/cargo-scout-audit/tests/integration_tests/detectors/configuration.rs b/apps/cargo-scout-audit/tests/integration_tests/detectors/configuration.rs index e21da35c..dfab0317 100644 --- a/apps/cargo-scout-audit/tests/integration_tests/detectors/configuration.rs +++ b/apps/cargo-scout-audit/tests/integration_tests/detectors/configuration.rs @@ -34,7 +34,6 @@ impl Configuration { .ok_or(anyhow!("Failed to find testcases path"))? .join("test-cases"); let testcases_paths: Vec = std::fs::read_dir(&testcases_root_path)? - .into_iter() .filter_map(|r| r.ok().map(|f| f.path())) .filter(|r| r.is_dir()) .collect(); @@ -47,7 +46,6 @@ impl Configuration { let detector_name = detector.to_string(); let testcases_root_path = testcases_root_path.join(detector_name); let testcases_paths: Vec = std::fs::read_dir(testcases_root_path)? - .into_iter() .filter_map(|r| r.ok().map(|f| f.path())) .filter(|r| r.is_dir()) .collect(); @@ -101,7 +99,7 @@ impl Configuration { .into_iter() .sorted() .zip(Detector::iter().map(|d| d.to_string()).sorted()) - .filter(|(p, d)| p.file_name().unwrap().to_string_lossy() != d.to_string()) + .filter(|(p, d)| p.file_name().unwrap().to_string_lossy() != *d) .count(); if count > 0 { diff --git a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/Cargo.toml b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/Cargo.toml index 5e367c2e..5c2430e8 100644 --- a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/Cargo.toml +++ b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "unprotected-mapping-operation" +name = "unprotected-mapping-operation-remediated-1" version = "0.1.0" edition = "2021" diff --git a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/Cargo.toml b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/Cargo.toml index 5e367c2e..bbbbb53e 100644 --- a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/Cargo.toml +++ b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "unprotected-mapping-operation" +name = "unprotected-mapping-operation-vulnerable-1" version = "0.1.0" edition = "2021"