-
Notifications
You must be signed in to change notification settings - Fork 481
Closed
Description
Describe the bug
As far as I know, the proper sequence is running ruff
followed by ruff format
. From ruff-pre-commit:
When running with
--fix
, Ruff's lint hook should be placed before Ruff's formatter hook, and before Black, isort, and other formatting tools, as Ruff's fix behavior can output code changes that require reformatting.When running without
--fix
, Ruff's formatter hook can be placed before or after Ruff's lint hook.(As long as your Ruff configuration avoids any linter-formatter incompatibilities,
ruff format
should never introduce new lint errors, so it's safe to run Ruff's format hook afterruff check --fix.
)
How to reproduce
Lines 13 to 18 in 964d93c
- repo: https://github.com/astral-sh/ruff-pre-commit | |
rev: v0.4.3 | |
hooks: | |
- id: ruff-format | |
- id: ruff | |
args: [ "--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"] |
Expected behavior
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.3
hooks:
- id: ruff
args: [ "--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
- id: ruff-format
Metadata
Metadata
Assignees
Labels
No labels