Skip to content

Commit e25654f

Browse files
authored
Rollup merge of rust-lang#143493 - lolbinarycat:tidy-spellcheck-bless, r=Kobzol
tidy: use --bless for tidy spellcheck instead of spellcheck:fix previous behavior was inconsistent with existing extra checks. unsure if this needs a change tracker entry or a warning for people who try to use the old behavior. unsure if we should call this `spellcheck:lint` for consistency. making this consistent is a prerequisite for rust-lang#143398 cc `@nnethercote` r? `@Kobzol`
2 parents 534c09a + 9f78173 commit e25654f

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/bootstrap/src/utils/change_tracker.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,4 +446,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
446446
severity: ChangeSeverity::Info,
447447
summary: "Added new option `build.tidy-extra-checks` to specify a default value for the --extra-checks cli flag.",
448448
},
449+
ChangeInfo {
450+
change_id: 143493,
451+
severity: ChangeSeverity::Warning,
452+
summary: "The `spellcheck:fix` tidy extra check argument has been removed, use `--bless` instead",
453+
},
449454
];

src/tools/tidy/src/ext_tool_checks.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,21 @@ fn check_impl(
6565
None => vec![],
6666
};
6767

68+
if lint_args.contains(&"spellcheck:fix") {
69+
return Err(Error::Generic(
70+
"`spellcheck:fix` is no longer valid, use `--extra=check=spellcheck --bless`"
71+
.to_string(),
72+
));
73+
}
74+
6875
let python_all = lint_args.contains(&"py");
6976
let python_lint = lint_args.contains(&"py:lint") || python_all;
7077
let python_fmt = lint_args.contains(&"py:fmt") || python_all;
7178
let shell_all = lint_args.contains(&"shell");
7279
let shell_lint = lint_args.contains(&"shell:lint") || shell_all;
7380
let cpp_all = lint_args.contains(&"cpp");
7481
let cpp_fmt = lint_args.contains(&"cpp:fmt") || cpp_all;
75-
let spellcheck_all = lint_args.contains(&"spellcheck");
76-
let spellcheck_fix = lint_args.contains(&"spellcheck:fix");
82+
let spellcheck = lint_args.contains(&"spellcheck");
7783

7884
let mut py_path = None;
7985

@@ -226,7 +232,7 @@ fn check_impl(
226232
shellcheck_runner(&merge_args(&cfg_args, &file_args_shc))?;
227233
}
228234

229-
if spellcheck_all || spellcheck_fix {
235+
if spellcheck {
230236
let config_path = root_path.join("typos.toml");
231237
// sync target files with .github/workflows/spellcheck.yml
232238
let mut args = vec![
@@ -238,11 +244,11 @@ fn check_impl(
238244
"./src/librustdoc",
239245
];
240246

241-
if spellcheck_all {
242-
eprintln!("spellcheck files");
243-
} else if spellcheck_fix {
247+
if bless {
244248
eprintln!("spellcheck files and fix");
245249
args.push("--write-changes");
250+
} else {
251+
eprintln!("spellcheck files");
246252
}
247253
spellcheck_runner(&args)?;
248254
}

0 commit comments

Comments
 (0)