(
report: &mut AnalysisReport,
registry: &mut ParserRegistry,
change: &str,
path: &str,
before: Result<Option<&[u8]>, String>,
after: &[u8],
added: bool,
)
| 277 | } |
| 278 | |
| 279 | fn inspect_content( |
| 280 | report: &mut AnalysisReport, |
| 281 | registry: &mut ParserRegistry, |
| 282 | change: &str, |
| 283 | path: &str, |
| 284 | before: Result<Option<&[u8]>, String>, |
| 285 | after: &[u8], |
| 286 | added: bool, |
| 287 | ) { |
| 288 | let after = match parse(registry, path, after) { |
| 289 | Ok(after) => after, |
| 290 | Err(reason) => { |
| 291 | checks(report, change, path, CheckStatus::Skipped, &reason); |
| 292 | return; |
| 293 | } |
| 294 | }; |
| 295 | let baseline = match before { |
| 296 | Ok(Some(bytes)) => parse(registry, path, bytes), |
| 297 | Ok(None) if added => Ok(StructuralInspection { |
| 298 | issues: Vec::new(), |
| 299 | has_syntax_errors: false, |
| 300 | ambiguous_manageability_subjects: Vec::new(), |
| 301 | }), |
| 302 | Ok(None) => Err("No before-content and no explicit file-creation operation".into()), |
| 303 | Err(reason) => Err(format!("Recorded before-content unavailable: {reason}")), |
| 304 | }; |
| 305 | inspect_parsed(report, change, path, after, baseline, false); |
| 306 | } |
| 307 | |
| 308 | fn inspect_parsed( |
| 309 | report: &mut AnalysisReport, |
no test coverage detected