-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x fmt
tries to format non-rust files
#106261
Comments
I think we just need to filter .rs files before passing them to rustfmt. |
This will probably be hit a lot by contributors so I'll pin it for better visibility. |
x fmt
tries to format ftl and stderr filesx fmt
tries to format non-rust files
@rustbot claim |
Normally, the walker already filters for |
The workaround is to run |
I think if we add it like this: ignore_fmt.add(&format!("!/{}", untracked_path)).expect(&untracked_path);
|
Maybe try to put the part I added before the ignore part, maybe this makes the ignore list work again? The thing that intrigues me the most is the fact that the |
For any Rust files we changed locally, our current solution will try to format it, in some scenarios we may not want to format it, such as some files in UI? |
Seems right, my current fix is not completed. |
I think since you explicitly add the files to |
from my local experiment, seems cat@LAPTOP-V6U0QKD4:~/code/rust$ x fmt
Building rustbuild
Compiling bootstrap v0.0.0 (/home/cat/code/rust/src/bootstrap)
Finished dev [unoptimized] target(s) in 5.25s
formatting modified file library/portable-simd/crates/core_simd/src/vendor/arm.rs
formatting modified file src/bootstrap/format.rs
formatting modified file src/tools/miri/src/bin/miri.rs
really try to format: DirEntry { dent: Raw(DirEntryRaw { path: "/home/cat/code/rust/src/bootstrap/format.rs", follow_link: false, depth: 3 }), err: None }
Build completed successfully in 0:00:07 |
…ter, r=jyn514 Formatter should not try to format non-Rust files Fixes rust-lang#106261
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-high |
Previously, `x fmt` would only format modified files, while `x fmt .` and `x fmt --check` would still look at all files. After this change, `x fmt --check` only looks at modified files locally. I feel pretty confident in this change - other than rust-lang#106261, no one has reported bugs in `get_modified_rs_files` since it was added in rust-lang#105702.
…rsan68 x fmt: Only check modified files locally Previously, `x fmt` would only format modified files, while `x fmt .` and `x fmt --check` would still look at all files. After this change, `x fmt --check` only looks at modified files locally. I feel pretty confident in this change - other than rust-lang#106261, no one has reported bugs in `get_modified_rs_files` since it was added in rust-lang#105702. Combined with the changes in rust-lang#108772, this brings the time for me to run `x t tidy` with a hot FS cache down from 5 to 2 seconds (and moves the majority of the time spent back to `tidy check`, which means it can be sped up more in the future).
When there was a change in a
.ftl
or other non-rust file, bootstrap tries to format it, which makes rustfmt very sad.cc @albertlarsan68 and @jyn514 who broke this in #105702
The text was updated successfully, but these errors were encountered: