astral-sh / astral-sh/ruff-pre-commit
Add a combined hook that does formatting and checking in a single step
- Dominant language
- Python
- Stars
- 2k
- Forks
- 105
- Avg merge
- 8h 36m
- Merged PRs (30d)
- 1
Description
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:
```yaml
- 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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Review the existing pre-commit hook configuration and the shell-based YAML example in the issue. Check the linked Ruff issue #8232 first to confirm the upstream combined command is available, then determine how the hook should expose it. Done means users can invoke one hook that runs Ruff checking and formatting in the intended order without the shell workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100