| 375 | |
| 376 | #[context("Linting")] |
| 377 | pub(crate) fn lint<'skip>( |
| 378 | root: &Dir, |
| 379 | warning_disposition: WarningDisposition, |
| 380 | root_type: RootType, |
| 381 | skip: impl IntoIterator<Item = &'skip str>, |
| 382 | mut output: impl std::io::Write, |
| 383 | no_truncate: bool, |
| 384 | ) -> Result<()> { |
| 385 | let config = LintExecutionConfig { no_truncate }; |
| 386 | let r = lint_inner(root, root_type, &config, skip, &mut output)?; |
| 387 | writeln!(output, "Checks passed: {}", r.passed)?; |
| 388 | if r.skipped > 0 { |
| 389 | writeln!(output, "Checks skipped: {}", r.skipped)?; |
| 390 | } |
| 391 | let fatal = if matches!(warning_disposition, WarningDisposition::FatalWarnings) { |
| 392 | r.fatal + r.warnings |
| 393 | } else { |
| 394 | r.fatal |
| 395 | }; |
| 396 | if r.warnings > 0 { |
| 397 | writeln!(output, "Warnings: {}", r.warnings)?; |
| 398 | } |
| 399 | if fatal > 0 { |
| 400 | anyhow::bail!("Checks failed: {}", fatal) |
| 401 | } |
| 402 | Ok(()) |
| 403 | } |
| 404 | |
| 405 | /// check for the existence of the /var/run directory |
| 406 | /// if it exists we need to check that it links to /run if not error |