Skip to content

Commit

Permalink
Unrolled build for rust-lang#119486
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#119486 - onur-ozkan:clippy-allow-dirty-and-staged, r=Mark-Simulacrum

pass allow-{dirty,staged} to clippy

Support of Clippy's `--allow-dirty` and `--allow-staged` flags on bootstrap.

Resolves rust-lang#119483
  • Loading branch information
rust-timer authored Jan 6, 2024
2 parents 9212108 + 96bd9cd commit 2d0c651
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/bootstrap/src/core/build_steps/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ fn args(builder: &Builder<'_>) -> Vec<String> {
arr.iter().copied().map(String::from)
}

if let Subcommand::Clippy { fix, allow, deny, warn, forbid, .. } = &builder.config.cmd {
if let Subcommand::Clippy { fix, allow_dirty, allow_staged, allow, deny, warn, forbid } =
&builder.config.cmd
{
// disable the most spammy clippy lints
let ignored_lints = vec![
"many_single_char_names", // there are a lot in stdarch
Expand All @@ -49,7 +51,16 @@ fn args(builder: &Builder<'_>) -> Vec<String> {
// As a workaround, avoid checking tests and benches when passed --fix.
"--lib", "--bins", "--examples",
]));

if *allow_dirty {
args.push("--allow-dirty".to_owned());
}

if *allow_staged {
args.push("--allow-staged".to_owned());
}
}

args.extend(strings(&["--", "--cap-lints", "warn"]));
args.extend(ignored_lints.iter().map(|lint| format!("-Aclippy::{}", lint)));
let mut clippy_lint_levels: Vec<String> = Vec::new();
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/src/core/config/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ pub enum Subcommand {
Clippy {
#[arg(long)]
fix: bool,
#[arg(long, requires = "fix")]
allow_dirty: bool,
#[arg(long, requires = "fix")]
allow_staged: bool,
/// clippy lints to allow
#[arg(global(true), short = 'A', action = clap::ArgAction::Append, value_name = "LINT")]
allow: Vec<String>,
Expand Down
2 changes: 2 additions & 0 deletions src/etc/completions/x.py.fish
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ complete -c x.py -n "__fish_seen_subcommand_from clippy" -l llvm-profile-use -d
complete -c x.py -n "__fish_seen_subcommand_from clippy" -l reproducible-artifact -d 'Additional reproducible artifacts that should be added to the reproducible artifacts archive' -r
complete -c x.py -n "__fish_seen_subcommand_from clippy" -l set -d 'override options in config.toml' -r -f
complete -c x.py -n "__fish_seen_subcommand_from clippy" -l fix
complete -c x.py -n "__fish_seen_subcommand_from clippy" -l allow-dirty
complete -c x.py -n "__fish_seen_subcommand_from clippy" -l allow-staged
complete -c x.py -n "__fish_seen_subcommand_from clippy" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
complete -c x.py -n "__fish_seen_subcommand_from clippy" -s i -l incremental -d 'use incremental compilation'
complete -c x.py -n "__fish_seen_subcommand_from clippy" -l include-default-paths -d 'include default paths in addition to the provided ones'
Expand Down
2 changes: 2 additions & 0 deletions src/etc/completions/x.py.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
[CompletionResult]::new('--reproducible-artifact', 'reproducible-artifact', [CompletionResultType]::ParameterName, 'Additional reproducible artifacts that should be added to the reproducible artifacts archive')
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
[CompletionResult]::new('--fix', 'fix', [CompletionResultType]::ParameterName, 'fix')
[CompletionResult]::new('--allow-dirty', 'allow-dirty', [CompletionResultType]::ParameterName, 'allow-dirty')
[CompletionResult]::new('--allow-staged', 'allow-staged', [CompletionResultType]::ParameterName, 'allow-staged')
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'use incremental compilation')
Expand Down
2 changes: 1 addition & 1 deletion src/etc/completions/x.py.sh
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ _x.py() {
return 0
;;
x.py__clippy)
opts="-A -D -W -F -v -i -j -h --fix --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --error-format --json-output --color --bypass-bootstrap-lock --llvm-skip-rebuild --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --help [PATHS]... [ARGS]..."
opts="-A -D -W -F -v -i -j -h --fix --allow-dirty --allow-staged --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --error-format --json-output --color --bypass-bootstrap-lock --llvm-skip-rebuild --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --help [PATHS]... [ARGS]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down
2 changes: 2 additions & 0 deletions src/etc/completions/x.py.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ _arguments "${_arguments_options[@]}" \
'*--reproducible-artifact=[Additional reproducible artifacts that should be added to the reproducible artifacts archive]:REPRODUCIBLE_ARTIFACT: ' \
'*--set=[override options in config.toml]:section.option=value:( )' \
'--fix[]' \
'--allow-dirty[]' \
'--allow-staged[]' \
'*-v[use verbose output (-vv for very verbose)]' \
'*--verbose[use verbose output (-vv for very verbose)]' \
'-i[use incremental compilation]' \
Expand Down

0 comments on commit 2d0c651

Please sign in to comment.