Skip to content

Commit 840a235

Browse files
committed
lints: Add --no-truncate flag to bootc container lint
Useful when running automatic reports and analyses where all issues need to be visible at once without truncation. To do this we needed to add a LintExecutionConfig to propagate configuration through the lint system. Also, refactor how we print things so there's a shared helper functions for consistent formatting with and without truncation. Closes: #1260 Signed-off-by: Colin Walters <[email protected]>
1 parent ee78dbc commit 840a235

File tree

2 files changed

+321
-140
lines changed

2 files changed

+321
-140
lines changed

lib/src/cli.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ pub(crate) enum ContainerOpts {
279279
/// Example: --skip nonempty-boot --skip baseimage-root
280280
#[clap(long)]
281281
skip: Vec<String>,
282+
283+
/// Don't truncate the output. By default, only a limited number of entries are
284+
/// shown for each lint, followed by a count of remaining entries.
285+
#[clap(long)]
286+
no_truncate: bool,
282287
},
283288
}
284289

@@ -1095,6 +1100,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
10951100
fatal_warnings,
10961101
list,
10971102
skip,
1103+
no_truncate,
10981104
} => {
10991105
if list {
11001106
return lints::lint_list(std::io::stdout().lock());
@@ -1112,7 +1118,14 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
11121118

11131119
let root = &Dir::open_ambient_dir(rootfs, cap_std::ambient_authority())?;
11141120
let skip = skip.iter().map(|s| s.as_str());
1115-
lints::lint(root, warnings, root_type, skip, std::io::stdout().lock())?;
1121+
lints::lint(
1122+
root,
1123+
warnings,
1124+
root_type,
1125+
skip,
1126+
std::io::stdout().lock(),
1127+
no_truncate,
1128+
)?;
11161129
Ok(())
11171130
}
11181131
},

0 commit comments

Comments
 (0)