ruff-pre-commit
ruff-pre-commit copied to clipboard
Add a combined hook that does formatting and checking in a single step
It would prove very useful to have a single hook that runs both check and format commands chained. That is not only for performance reasons but also for keeping the hook configs in sync and avoiding calling them in the wrong order.
At this moment we are using a hack like below:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.9
hooks:
- id: ruff
entry: sh -c 'ruff check --fix --force-exclude && ruff format --force-exclude'
Once https://github.com/astral-sh/ruff/issues/8232 is implemented, we can replace the shell command with a single ruff call.
+1, thx @ssbarnea