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

Should we add --check for ruff format? #61

Closed
huxuan opened this issue Dec 4, 2023 · 1 comment
Closed

Should we add --check for ruff format? #61

huxuan opened this issue Dec 4, 2023 · 1 comment
Labels
question Further information is requested

Comments

@huxuan
Copy link

huxuan commented Dec 4, 2023

According to the exit codes, without --check, the exit code of ruff format will be

0 if Ruff terminates successfully, regardless of whether any files were formatted.

So, I assume to have the pre-commit run as expected, we should add --check flag, right?

@charliermarsh
Copy link
Member

Good question! It shouldn't be necessary since pre-commit will already exit with failure if a hook modifies files -- so if files need to be formatted, pre-commit will fail (as expected), but the files will be formatted, which is typically desirable. (You can run with --check, but the files won't be formatted, so ultimately up to you as to what you prefer.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants