Skip to content

Commit 9f5cfdf

Browse files
committed
add tidy flags and ignore untracked
1 parent 2607f16 commit 9f5cfdf

39 files changed

+402
-198
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,12 @@ impl Step for Tidy {
12351235
if builder.config.cmd.bless() {
12361236
cmd.arg("--bless");
12371237
}
1238+
if builder.config.cmd.pre_push() {
1239+
cmd.arg("--pre-push");
1240+
}
1241+
if builder.config.cmd.include_untracked() {
1242+
cmd.arg("--include-untracked");
1243+
}
12381244
if let Some(s) =
12391245
builder.config.cmd.extra_checks().or(builder.config.tidy_extra_checks.as_deref())
12401246
{

src/bootstrap/src/core/config/flags.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,12 @@ pub enum Subcommand {
391391
/// whether to automatically update stderr/stdout files
392392
bless: bool,
393393
#[arg(long)]
394+
/// Whether to run Tidy on the most recent commit, used in the pre-push git-hook.
395+
pre_push: bool,
396+
#[arg(long)]
397+
/// Whether to include files untracked by git when running Tidy.
398+
include_untracked: bool,
399+
#[arg(long)]
394400
/// comma-separated list of other files types to check (accepts py, py:lint,
395401
/// py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck, spellcheck)
396402
///
@@ -571,6 +577,20 @@ impl Subcommand {
571577
}
572578
}
573579

580+
pub fn pre_push(&self) -> bool {
581+
match *self {
582+
Subcommand::Test { pre_push, .. } => pre_push,
583+
_ => false,
584+
}
585+
}
586+
587+
pub fn include_untracked(&self) -> bool {
588+
match *self {
589+
Subcommand::Test { include_untracked, .. } => include_untracked,
590+
_ => false,
591+
}
592+
}
593+
574594
pub fn extra_checks(&self) -> Option<&str> {
575595
match *self {
576596
Subcommand::Test { ref extra_checks, .. } => extra_checks.as_ref().map(String::as_str),

src/etc/completions/x.fish

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ complete -c x -n "__fish_x_using_subcommand test" -l no-fail-fast -d 'run all te
332332
complete -c x -n "__fish_x_using_subcommand test" -l no-doc -d 'do not run doc tests'
333333
complete -c x -n "__fish_x_using_subcommand test" -l doc -d 'only run doc tests'
334334
complete -c x -n "__fish_x_using_subcommand test" -l bless -d 'whether to automatically update stderr/stdout files'
335+
complete -c x -n "__fish_x_using_subcommand test" -l pre-push -d 'Whether to run Tidy on the most recent commit, used in the pre-push git-hook'
336+
complete -c x -n "__fish_x_using_subcommand test" -l include-untracked -d 'Whether to include files untracked by git when running Tidy'
335337
complete -c x -n "__fish_x_using_subcommand test" -l force-rerun -d 'rerun tests even if the inputs are unchanged'
336338
complete -c x -n "__fish_x_using_subcommand test" -l only-modified -d 'only run tests that result has been changed'
337339
complete -c x -n "__fish_x_using_subcommand test" -l rustfix-coverage -d 'enable this to generate a Rustfix coverage file, which is saved in `/<build_base>/rustfix_missing_coverage.txt`'

src/etc/completions/x.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ Register-ArgumentCompleter -Native -CommandName 'x' -ScriptBlock {
379379
[CompletionResult]::new('--no-doc', '--no-doc', [CompletionResultType]::ParameterName, 'do not run doc tests')
380380
[CompletionResult]::new('--doc', '--doc', [CompletionResultType]::ParameterName, 'only run doc tests')
381381
[CompletionResult]::new('--bless', '--bless', [CompletionResultType]::ParameterName, 'whether to automatically update stderr/stdout files')
382+
[CompletionResult]::new('--pre-push', '--pre-push', [CompletionResultType]::ParameterName, 'Whether to run Tidy on the most recent commit, used in the pre-push git-hook')
383+
[CompletionResult]::new('--include-untracked', '--include-untracked', [CompletionResultType]::ParameterName, 'Whether to include files untracked by git when running Tidy')
382384
[CompletionResult]::new('--force-rerun', '--force-rerun', [CompletionResultType]::ParameterName, 'rerun tests even if the inputs are unchanged')
383385
[CompletionResult]::new('--only-modified', '--only-modified', [CompletionResultType]::ParameterName, 'only run tests that result has been changed')
384386
[CompletionResult]::new('--rustfix-coverage', '--rustfix-coverage', [CompletionResultType]::ParameterName, 'enable this to generate a Rustfix coverage file, which is saved in `/<build_base>/rustfix_missing_coverage.txt`')

src/etc/completions/x.py.fish

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ complete -c x.py -n "__fish_x.py_using_subcommand test" -l no-fail-fast -d 'run
332332
complete -c x.py -n "__fish_x.py_using_subcommand test" -l no-doc -d 'do not run doc tests'
333333
complete -c x.py -n "__fish_x.py_using_subcommand test" -l doc -d 'only run doc tests'
334334
complete -c x.py -n "__fish_x.py_using_subcommand test" -l bless -d 'whether to automatically update stderr/stdout files'
335+
complete -c x.py -n "__fish_x.py_using_subcommand test" -l pre-push -d 'Whether to run Tidy on the most recent commit, used in the pre-push git-hook'
336+
complete -c x.py -n "__fish_x.py_using_subcommand test" -l include-untracked -d 'Whether to include files untracked by git when running Tidy'
335337
complete -c x.py -n "__fish_x.py_using_subcommand test" -l force-rerun -d 'rerun tests even if the inputs are unchanged'
336338
complete -c x.py -n "__fish_x.py_using_subcommand test" -l only-modified -d 'only run tests that result has been changed'
337339
complete -c x.py -n "__fish_x.py_using_subcommand test" -l rustfix-coverage -d 'enable this to generate a Rustfix coverage file, which is saved in `/<build_base>/rustfix_missing_coverage.txt`'

src/etc/completions/x.py.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
379379
[CompletionResult]::new('--no-doc', '--no-doc', [CompletionResultType]::ParameterName, 'do not run doc tests')
380380
[CompletionResult]::new('--doc', '--doc', [CompletionResultType]::ParameterName, 'only run doc tests')
381381
[CompletionResult]::new('--bless', '--bless', [CompletionResultType]::ParameterName, 'whether to automatically update stderr/stdout files')
382+
[CompletionResult]::new('--pre-push', '--pre-push', [CompletionResultType]::ParameterName, 'Whether to run Tidy on the most recent commit, used in the pre-push git-hook')
383+
[CompletionResult]::new('--include-untracked', '--include-untracked', [CompletionResultType]::ParameterName, 'Whether to include files untracked by git when running Tidy')
382384
[CompletionResult]::new('--force-rerun', '--force-rerun', [CompletionResultType]::ParameterName, 'rerun tests even if the inputs are unchanged')
383385
[CompletionResult]::new('--only-modified', '--only-modified', [CompletionResultType]::ParameterName, 'only run tests that result has been changed')
384386
[CompletionResult]::new('--rustfix-coverage', '--rustfix-coverage', [CompletionResultType]::ParameterName, 'enable this to generate a Rustfix coverage file, which is saved in `/<build_base>/rustfix_missing_coverage.txt`')

src/etc/completions/x.py.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3875,7 +3875,7 @@ _x.py() {
38753875
return 0
38763876
;;
38773877
x.py__test)
3878-
opts="-v -i -j -h --no-fail-fast --test-args --compiletest-rustc-args --no-doc --doc --bless --extra-checks --force-rerun --only-modified --compare-mode --pass --run --rustfix-coverage --no-capture --test-codegen-backend --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 --json-output --compile-time-deps --color --bypass-bootstrap-lock --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --ci --skip-std-check-if-no-download-rustc --help [PATHS]... [ARGS]..."
3878+
opts="-v -i -j -h --no-fail-fast --test-args --compiletest-rustc-args --no-doc --doc --bless --pre-push --include-untracked --extra-checks --force-rerun --only-modified --compare-mode --pass --run --rustfix-coverage --no-capture --test-codegen-backend --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 --json-output --compile-time-deps --color --bypass-bootstrap-lock --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --ci --skip-std-check-if-no-download-rustc --help [PATHS]... [ARGS]..."
38793879
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
38803880
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
38813881
return 0

src/etc/completions/x.py.zsh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ _arguments "${_arguments_options[@]}" : \
379379
'--no-doc[do not run doc tests]' \
380380
'--doc[only run doc tests]' \
381381
'--bless[whether to automatically update stderr/stdout files]' \
382+
'--pre-push[Whether to run Tidy on the most recent commit, used in the pre-push git-hook]' \
383+
'--include-untracked[Whether to include files untracked by git when running Tidy]' \
382384
'--force-rerun[rerun tests even if the inputs are unchanged]' \
383385
'--only-modified[only run tests that result has been changed]' \
384386
'--rustfix-coverage[enable this to generate a Rustfix coverage file, which is saved in \`/<build_base>/rustfix_missing_coverage.txt\`]' \

src/etc/completions/x.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3875,7 +3875,7 @@ _x() {
38753875
return 0
38763876
;;
38773877
x__test)
3878-
opts="-v -i -j -h --no-fail-fast --test-args --compiletest-rustc-args --no-doc --doc --bless --extra-checks --force-rerun --only-modified --compare-mode --pass --run --rustfix-coverage --no-capture --test-codegen-backend --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 --json-output --compile-time-deps --color --bypass-bootstrap-lock --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --ci --skip-std-check-if-no-download-rustc --help [PATHS]... [ARGS]..."
3878+
opts="-v -i -j -h --no-fail-fast --test-args --compiletest-rustc-args --no-doc --doc --bless --pre-push --include-untracked --extra-checks --force-rerun --only-modified --compare-mode --pass --run --rustfix-coverage --no-capture --test-codegen-backend --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 --json-output --compile-time-deps --color --bypass-bootstrap-lock --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --ci --skip-std-check-if-no-download-rustc --help [PATHS]... [ARGS]..."
38793879
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
38803880
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
38813881
return 0

src/etc/completions/x.zsh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ _arguments "${_arguments_options[@]}" : \
379379
'--no-doc[do not run doc tests]' \
380380
'--doc[only run doc tests]' \
381381
'--bless[whether to automatically update stderr/stdout files]' \
382+
'--pre-push[Whether to run Tidy on the most recent commit, used in the pre-push git-hook]' \
383+
'--include-untracked[Whether to include files untracked by git when running Tidy]' \
382384
'--force-rerun[rerun tests even if the inputs are unchanged]' \
383385
'--only-modified[only run tests that result has been changed]' \
384386
'--rustfix-coverage[enable this to generate a Rustfix coverage file, which is saved in \`/<build_base>/rustfix_missing_coverage.txt\`]' \

0 commit comments

Comments
 (0)