-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add --exit-non-zero-on-format #16009
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
crates/ruff/src/args.rs
Outdated
#[arg(long, help_heading = "Miscellaneous")] | ||
pub exit_non_zero_on_format: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you find ruff format --exit-non-zero-on-format
awkward? Should it be ruff format --exit-non-zero-on-change
or --exit-non-zero-on-write
? It might be nice to switch to an agnostic name.
Should we retain the on_fix
language we use for ruff check
? I see the motivation for not, but at the very least we probably want an alias for parity with ruff check
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current name was meant to "reflect" "exit non zero on (action)", to mirror "on fix".
As for the ergonomics? I really don't have an opinion. I can't imagine anyone using this flag outside of some kind of config file or script file of some sort. In which case the name is really only as important as "can be discovered" and "name reflects what happens". So I think the bike shed on the name (past probably "exit non zero on ...") doesn't bother me. I'm happy to use whatever yall like most!
(On second thought, I do want to talk briefly about the name before merging) |
@zanieb bump? |
Thanks for the bump, sorry about the delay. Let me prod some others on painting this bikeshed. |
No worries! My hobby project exploring But this week I decided to make another hobby project and remembered this issue 😁 |
Thanks again for your work on this! After discussing internally, we liked your |
* main: (26 commits) Use the common `OperatorPrecedence` for the parser (#16747) [red-knot] Check subtype relation between callable types (#16804) [red-knot] Check whether two callable types are equivalent (#16698) [red-knot] Ban most `Type::Instance` types in type expressions (#16872) Special-case value-expression inference of special form subscriptions (#16877) [syntax-errors] Fix star annotation before Python 3.11 (#16878) Recognize `SyntaxError:` as an error code for ecosystem checks (#16879) [red-knot] add test cases result in false positive errors (#16856) Bump 0.11.1 (#16871) Allow discovery of venv in VIRTUAL_ENV env variable (#16853) Split git pathspecs in change determination onto separate lines (#16869) Use the correct base commit for change determination (#16857) Separate `BitXorOr` into `BitXor` and `BitOr` precedence (#16844) Server: Allow `FixAll` action in presence of version-specific syntax errors (#16848) [`refurb`] Fix starred expressions fix (`FURB161`) (#16550) [`flake8-executable`] Add pytest and uv run to help message for `shebang-missing-python` (`EXE003`) (#16855) Show more precise messages in invalid type expressions (#16850) [`flake8-executables`] Allow `uv run` in shebang line for `shebang-missing-python` (`EXE003`) (#16849) Add `--exit-non-zero-on-format` (#16009) [red-knot] Ban list literals in most contexts in type expressions (#16847) ...
Summary
Fixes #8191 by introducing
--exit-non-zero-on-format
toruff format
which pretty much does what it says on the tin.Test Plan
Added a new test!