-
Notifications
You must be signed in to change notification settings - Fork 41
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
--range support #94
Comments
Hi! Would you be able to do this using the - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
hooks:
- id: ruff
name: Run ruff
args: ["--range=1:2-3:4"] |
Unfortunately not -- that would hardcode all pre-commits to use that specific range. I was thinking that it would be ideal if ruff could somehow receive the line numbers edited in the git commit and pass those along to ruff formatter, per-file. So it would basically only format the lines that were touched by the commit rather than all files touched. But I don't know if that's supported within the pre-commit framework. |
Ahh I see, thanks for explaining |
Yeah, this requires pre-commit support and possibly support for passing multiple ranges astral-sh/ruff#12800 |
Ruff introduced a new parameter
--range
that allows the formatter to only check the specified range. This would be useful to allow migrating from black to ruff formatting without causing whole-file diffs whenever a file is touched for the first time.Quote from docs:
Is there a way to have range support within the pre-commit framework?
The text was updated successfully, but these errors were encountered: