-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[feature] Add ability to specify --range
option multiple times
#12800
Comments
Thanks for opening this issue and doing the extra work of finding the PR where it was added. Could you tell us a bit more about your workflow? It seems you're already calling ruff in an automated way. |
Sure! I don't have this in use on any large projects (yet), but I work on some Python projects that don't have an established code style currently. I've written a small program that calls To make sure my contributions to these projects follow a consistent style (I use the black style on all my personal stuff), I set up a pre-commit hook that runs this tool in a Some editors allow you to pass selections to the formatter, so that's a partial workaround for this issue. However, this doesn't allow a pre-commit check, and the editor I'm currently using the most (Zed) does not support this. |
This will also be useful in implementing the upcoming (3.18) LSP feature |
Just to add a related note: the use case @afontenot described is the reason Full disclosure: I'm a |
This feature would increase feature parity with
black
, which supports multiply specifying the equivalent--line-ranges
option.Accepting multiple ranges is extremely useful for programmatically checking / modifying the format of the changed portions of a file when changes occur. For example, on some code bases a style guide has not been correctly adhered to historically, but project maintainers want to ensure that all new work adheres to
ruff format
checks.Some discussion of this happened in the original
--range
pull request #9733, which I'll copy here:While I do agree that this adds some complexity, I think it's a valuable feature and I didn't see an open issue for it, so I decided to file one to hopefully push this forward.
The text was updated successfully, but these errors were encountered: