Skip to content

Commit a411267

Browse files
committed
Auto merge of #13210 - Alexendoo:lintcheck-force-warn, r=xFrednet
lintcheck: force warn all lints It occurred to me that like `--filter` we could use `--force-warn` for normal operations, we especially want to see lints that crates decided were too annoying or were false positives Also excludes `clippy::cargo` from the default set as nobody is really writing those and it slows things down r? `@xFrednet` changelog: none
2 parents cfb3881 + d18ce7c commit a411267

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

.github/workflows/lintcheck.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858

5959
- name: Run lintcheck
6060
if: steps.cache-json.outputs.cache-hit != 'true'
61-
run: ./target/debug/lintcheck --format json --warn-all --crates-toml ./lintcheck/ci_crates.toml
61+
run: ./target/debug/lintcheck --format json --all-lints --crates-toml ./lintcheck/ci_crates.toml
6262

6363
- name: Upload base JSON
6464
uses: actions/upload-artifact@v4
@@ -86,7 +86,7 @@ jobs:
8686
run: cargo build --manifest-path=lintcheck/Cargo.toml
8787

8888
- name: Run lintcheck
89-
run: ./target/debug/lintcheck --format json --warn-all --crates-toml ./lintcheck/ci_crates.toml
89+
run: ./target/debug/lintcheck --format json --all-lints --crates-toml ./lintcheck/ci_crates.toml
9090

9191
- name: Upload head JSON
9292
uses: actions/upload-artifact@v4

lintcheck/src/config.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ pub(crate) struct LintcheckConfig {
3333
/// Runs cargo clippy --fix and checks if all suggestions apply
3434
#[clap(long, conflicts_with("max_jobs"))]
3535
pub fix: bool,
36-
/// Apply a filter to only collect specified lints, this also overrides `allow` attributes
36+
/// Apply a filter to only collect specified lints
3737
#[clap(long = "filter", value_name = "clippy_lint_name", use_value_delimiter = true)]
3838
pub lint_filter: Vec<String>,
39-
/// Set all lints to the "warn" lint level, even resitriction ones. Usually,
40-
/// it's better to use `--filter` instead
39+
/// Check all Clippy lints, by default only `clippy::all` and `clippy::pedantic` are checked.
40+
/// Usually, it's better to use `--filter` instead
4141
#[clap(long, conflicts_with("lint_filter"))]
42-
pub warn_all: bool,
42+
pub all_lints: bool,
4343
/// Set the output format of the log file
4444
#[clap(long, short, default_value = "text")]
4545
pub format: OutputFormat,

lintcheck/src/main.rs

+10-15
Original file line numberDiff line numberDiff line change
@@ -284,29 +284,24 @@ fn lintcheck(config: LintcheckConfig) {
284284
let (crates, recursive_options) = read_crates(&config.sources_toml_path);
285285

286286
let counter = AtomicUsize::new(1);
287-
let mut lint_level_args: Vec<String> = vec![];
287+
let mut lint_level_args: Vec<String> = vec!["--cap-lints=allow".into()];
288288
if config.lint_filter.is_empty() {
289-
lint_level_args.push("--cap-lints=warn".to_string());
290-
291-
// Set allow-by-default to warn
292-
if config.warn_all {
293-
[
289+
let groups = if config.all_lints {
290+
&[
291+
"clippy::all",
294292
"clippy::cargo",
295293
"clippy::nursery",
296294
"clippy::pedantic",
297295
"clippy::restriction",
298-
]
296+
][..]
297+
} else {
298+
&["clippy::all", "clippy::pedantic"]
299+
};
300+
groups
299301
.iter()
300-
.map(|group| format!("--warn={group}"))
302+
.map(|group| format!("--force-warn={group}"))
301303
.collect_into(&mut lint_level_args);
302-
} else {
303-
["clippy::cargo", "clippy::pedantic"]
304-
.iter()
305-
.map(|group| format!("--warn={group}"))
306-
.collect_into(&mut lint_level_args);
307-
}
308304
} else {
309-
lint_level_args.push("--cap-lints=allow".to_string());
310305
config
311306
.lint_filter
312307
.iter()

0 commit comments

Comments
 (0)