[Feature Request] Allow command line option to only reformat specific lines · Issue #830 · psf/black (original) (raw)
Operating system: All
Python version: All Supported
Black version: Future
Does also happen on master: Yes
Currently if black is used on an existing project base it will likely create a huge diff as many lines will be changed. Some projects discourage this or only allow it on a major version change.
One way to address this would be to allow per file line ranges to specify that only those lines be considered for re-formatting in a similar manner to yapf --lines
option. This would allow black reformatting of changed lines only.
This ticket raised in response to python/steering-council#9 (comment) but of course it could be considered a compromise.