Skip to content

[Feature Request] Allow command line option to only reformat specific lines #830

@GadgetSteve

Description

@GadgetSteve

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions