diff --git a/src/errors.rs b/src/errors.rs index 7da3214..d0f7910 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -87,5 +87,5 @@ pub enum ImageValidationError { MalformedImageName(String), #[error("Failed to parse the SARIF report: {0}")] - SarifParseError(String), + SarifParse(String), } diff --git a/src/sarif.rs b/src/sarif.rs index e2b66b6..4bce35f 100644 --- a/src/sarif.rs +++ b/src/sarif.rs @@ -52,7 +52,7 @@ impl Report { always_allowed: &HashSet, ) -> Result { if trivy_report.runs.len() != 1 { - return Err(ImageValidationError::SarifParseError(format!( + return Err(ImageValidationError::SarifParse(format!( "wrong number of 'run' items inside of trivy report, expected 1 got {}", trivy_report.runs.len() ))); diff --git a/src/sarif/trivy.rs b/src/sarif/trivy.rs index 0f39070..88a33ad 100644 --- a/src/sarif/trivy.rs +++ b/src/sarif/trivy.rs @@ -5,25 +5,24 @@ impl TryFrom for Report { type Error = ImageValidationError; fn try_from(sbombastic_vulnerability_report: VulnerabilityReport) -> Result { - let spec = - sbombastic_vulnerability_report - .spec - .ok_or(ImageValidationError::SarifParseError( - "missing VulnerabilityReportSpec".to_string(), - ))?; + let spec = sbombastic_vulnerability_report + .spec + .ok_or(ImageValidationError::SarifParse( + "missing VulnerabilityReportSpec".to_string(), + ))?; let report = serde_json::from_value::(spec.sarif) - .map_err(|e| ImageValidationError::SarifParseError(e.to_string()))?; + .map_err(|e| ImageValidationError::SarifParse(e.to_string()))?; if report.runs.len() != 1 { - return Err(ImageValidationError::SarifParseError(format!( + return Err(ImageValidationError::SarifParse(format!( "wrong number of 'run' items inside of trivy report, expected 1 got {}", report.runs.len() ))); } if report.runs[0].tool.driver.name != "Trivy" { - return Err(ImageValidationError::SarifParseError(format!( + return Err(ImageValidationError::SarifParse(format!( "wrong tool driver name inside of trivy report, expected 'Trivy' got '{}'", report.runs[0].tool.driver.name ))); diff --git a/src/sbombastic/mod.rs b/src/sbombastic.rs similarity index 100% rename from src/sbombastic/mod.rs rename to src/sbombastic.rs diff --git a/src/sbombastic/storage/mod.rs b/src/sbombastic/storage.rs similarity index 100% rename from src/sbombastic/storage/mod.rs rename to src/sbombastic/storage.rs diff --git a/src/sbombastic/storage/v1alpha1/mod.rs b/src/sbombastic/storage/v1alpha1.rs similarity index 100% rename from src/sbombastic/storage/v1alpha1/mod.rs rename to src/sbombastic/storage/v1alpha1.rs