Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thejcannon
Copy link
Contributor

Summary

Fixes #8191 by introducing --exit-non-zero-on-format to ruff format which pretty much does what it says on the tin.

Test Plan

Added a new test!

Copy link
Contributor

github-actions bot commented Feb 7, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser MichaReiser requested a review from zanieb February 7, 2025 06:44
@MichaReiser MichaReiser added the cli Related to the command-line interface label Feb 7, 2025
Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines +532 to +533
#[arg(long, help_heading = "Miscellaneous")]
pub exit_non_zero_on_format: bool,
Copy link
Member

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?

Copy link
Contributor Author

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!

@zanieb
Copy link
Member

zanieb commented Feb 8, 2025

(On second thought, I do want to talk briefly about the name before merging)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command-line interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an --exit-non-zero-on-fix equivalent to the formatter.
3 participants