Skip to content

Ruff pre commit on only changed lines #10977

Answered by MichaReiser
MadaraCx asked this question in Q&A
Discussion options

You must be logged in to vote

You can pass the --range option to ruff format

      --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>`.
          
          - The line and column numbers are 1 based.
          - The column specifies the nth-unicode codepoint on that line.
          - The end offset is exclusive.
          - The column numbers are optional. You can write `--range=1-2` instead of `--range=1:1-2:1`.
          - The end position is optional. You can wr…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@MadaraCx
Comment options

@MichaReiser
Comment options

Answer selected by MadaraCx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants