astral-sh / astral-sh/ruff-pre-commit
import sorting?
- Dominant language
- Python
- Stars
- 2k
- Forks
- 105
- Avg merge
- 8h 36m
- Merged PRs (30d)
- 1
Description
When I use this `pyproject.toml` config:
```toml
[tool.ruff]
select = [
"I", # isort formatting.
]
```
And this `.pre-commit-config.yaml`:
```yaml
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.13
hooks:
- id: ruff
types_or: [ python, pyi, jupyter ]
args: [ --fix ]
- id: ruff-format
types_or: [ python, pyi, jupyter ]
```
On code like this:
```python
from typing import TypeVar, Generic
T = TypeVar("T")
class CameraOptimizerConfig(Generic[T]):
pass
```
The `ruff` hook passes even though the imports aren't sorted:
```console
$ pre-commit run --verbose
ruff.....................................................................Passed
- hook id: ruff
- duration: 0.07s
ruff-format..............................................................Failed
- hook id: ruff-format
- duration: 0.01s
- files were modified by this hook
```
But if I run `ruff check --fix` manually it does fix the imports:
```console
$ ruff check nerfstudio/a.py --fix
Found 1 error (1 fixed, 0 remaining).
```
Am I missing some other configuration to get import sorting via the `ruff` `pre-commit` hook using `args: [ --fix ]`?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.