Rollup merge of #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 https://github.com/rust-lang/rust/pull/143398

cc `@nnethercote`

r? `@Kobzol`
This commit is contained in:
Matthias Krüger 2025-07-06 10:03:24 +02:00 committed by GitHub
commit e25654fb94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 6 deletions

View file

@ -446,4 +446,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
severity: ChangeSeverity::Info,
summary: "Added new option `build.tidy-extra-checks` to specify a default value for the --extra-checks cli flag.",
},
ChangeInfo {
change_id: 143493,
severity: ChangeSeverity::Warning,
summary: "The `spellcheck:fix` tidy extra check argument has been removed, use `--bless` instead",
},
];

View file

@ -65,6 +65,13 @@ fn check_impl(
None => vec![],
};
if lint_args.contains(&"spellcheck:fix") {
return Err(Error::Generic(
"`spellcheck:fix` is no longer valid, use `--extra=check=spellcheck --bless`"
.to_string(),
));
}
let python_all = lint_args.contains(&"py");
let python_lint = lint_args.contains(&"py:lint") || python_all;
let python_fmt = lint_args.contains(&"py:fmt") || python_all;
@ -72,8 +79,7 @@ fn check_impl(
let shell_lint = lint_args.contains(&"shell:lint") || shell_all;
let cpp_all = lint_args.contains(&"cpp");
let cpp_fmt = lint_args.contains(&"cpp:fmt") || cpp_all;
let spellcheck_all = lint_args.contains(&"spellcheck");
let spellcheck_fix = lint_args.contains(&"spellcheck:fix");
let spellcheck = lint_args.contains(&"spellcheck");
let mut py_path = None;
@ -226,7 +232,7 @@ fn check_impl(
shellcheck_runner(&merge_args(&cfg_args, &file_args_shc))?;
}
if spellcheck_all || spellcheck_fix {
if spellcheck {
let config_path = root_path.join("typos.toml");
// sync target files with .github/workflows/spellcheck.yml
let mut args = vec![
@ -238,11 +244,11 @@ fn check_impl(
"./src/librustdoc",
];
if spellcheck_all {
eprintln!("spellcheck files");
} else if spellcheck_fix {
if bless {
eprintln!("spellcheck files and fix");
args.push("--write-changes");
} else {
eprintln!("spellcheck files");
}
spellcheck_runner(&args)?;
}