-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Only format git diff (similar to clang-format-diff) #245
Comments
Black is unable to format line ranges. This would be rather problematic given how it's currently implemented. More importantly, this goes against PEP 8's philosophy of staying consistent within a file (and more generally, within a project). See #134 for a longer explanation. |
You can format the whole file and only commit relevant changes via |
This is not a planned feature. |
Also FYI, I wrote darker which can apply Black formatting only to lines which have changed in the Git working tree since the last commit. |
For quick solution, run the following script.
|
Relevant yapf issue: google/yapf#190
It would be really helpfull to only format code that was changed which also helps to minimize the diff.
clang-format-diff
example:The text was updated successfully, but these errors were encountered: