Skip to content

--range support #94

@skairunner

Description

@skairunner

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:

Editor options:
      --range <RANGE>  When specified, Ruff will try to only format the code in
                       the given range.
                       It might be necessary to extend the start backwards or
                       the end forwards, to fully enclose a logical line.
                       The `<RANGE>` uses the format
                       `<start_line>:<start_column>-<end_line>:<end_column>`.

Is there a way to have range support within the pre-commit framework?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions