make some tidy errors around python easier to understand#158552
Conversation
…s a standalone command - error if RUSTC isn't set, which means it'll fall back to the user-installed default (wrong) - be more specific in `--bless` suggestions that they should use `x test tidy`, not tidy directly.
for non-interactive cases, such as CI, this makes it easier to tell what went wrong without having to interactively debug the problem.
|
The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging. cc @davidtwco, @BoxyUwU |
|
r? @clubby789 rustbot has assigned @clubby789. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
i did not change any dependencies, no. |
|
cc @rust-lang/rustfmt |
|
rust-lang/rustfmt#6734 strikes again |
|
@rustbot label -T-rustfmt |
and just always show diffs by default. not sure why you'd want to hide them.
|
(reminder that i no longer have r+ permissions and need someone else to hit the merge button) |
|
@bors r=clubby789,davidtwco rollup |
|
omg bors is a fish now???? this is so good |
…y789,davidtwco make some tidy errors around python easier to understand someone i was helping hit a tidy python formatting error in CI, tried to run the exact `tidy` command that bootstrap printed as an error, got *another* error because rustc isn't installed globally, only locally, and then gave up in frustration because they couldn't tell what tidy even wanted them to fix. make some targeted improvements. i'm not sure why diffs were disabled by default before. it's been like that ever since python formatting was originally added in rust-lang#112482, with no explanation. i think showing the diff is a better default. before: ``` $ ./x t tidy --extra-checks=py:fmt checking python file formatting Would reformat: ferrocene/ci/scripts/calculate_parameters.py 1 file would be reformatted, 118 files already formatted rerun tidy with `--extra-checks=py:fmt --bless` to reformat Python code tidy [extra_checks:python_fmt]: checks with external tool 'ruff' failed tidy [extra_checks:python_fmt]: FAIL tidy: The following check failed: extra_checks:python_fmt Command `/home/ci/project/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy --root-path=/home/ci/project --cargo-path=/home/ci/project/build/x86_64-unknown-linux-gnu/stage0/bin/cargo --output-dir=/home/ci/project/build --concurrency=4 --npm-path=yarn --extra-checks=py:fmt` failed with exit code 1 Created at: src/bootstrap/src/core/build_steps/tool.rs:1630:23 Executed at: src/bootstrap/src/core/build_steps/test.rs:1533:29 Command has failed. Rerun with -v to see more details. Build completed unsuccessfully in 0:00:55 $ /home/ci/project/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy --root-path=/home/ci/project --cargo-path=/home/ci/project/build/x86_64-unknown-linux-gnu/stage0/bin/cargo --output-dir=/home/ci/project/build --concurrency=4 --npm-path=yarn --extra-checks=py:fmt --bless tidy [CI history]: no base commit found. Some checks will be skipped. thread 'deps (.)' (25771) panicked at src/tools/tidy/src/deps.rs:700:20: cmd.exec() failed with `cargo metadata` exited with an error: error: could not execute process `rustc -vV` (never executed) Caused by: No such file or directory (os error 2) note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'main' (25768) panicked at src/tools/tidy/src/main.rs:53:61: called `Result::unwrap()` on an `Err` value: Any { .. } ``` after: ``` checking python file formatting Would reformat: ferrocene/doc/specification/make.py 1 file would be reformatted, 118 files already formatted python formatting does not match! Printing diff: --- ferrocene/doc/specification/make.py +++ ferrocene/doc/specification/make.py @@ -64,6 +64,7 @@ return dest / builder + def build_linkchecker(root): repo = root / ".linkchecker" src = repo / "src" / "tools" / "linkchecker" 1 file would be reformatted, 118 files already formatted rerun with `--bless` to reformat Python code: `./x.py test tidy --extra-checks=py:fmt --bless` ``` ``` thread 'deps (.)' (249572429) panicked at src/tools/tidy/src/deps.rs:696:9: tidy must be run under bootstrap (./x test tidy), not as a standalone command note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
someone i was helping hit a tidy python formatting error in CI, tried to run the exact
tidycommand that bootstrap printed as an error, got another error because rustc isn't installed globally, only locally, and then gave up in frustration because they couldn't tell what tidy even wanted them to fix.make some targeted improvements.
i'm not sure why diffs were disabled by default before. it's been like that ever since python formatting was originally added in #112482, with no explanation. i think showing the diff is a better default.
before:
after: