Add alpha formatter support (#50)
This commit is contained in:
parent
9845d84394
commit
caa92debff
@ -1,10 +1,20 @@
|
|||||||
- id: ruff
|
- id: ruff
|
||||||
name: ruff
|
name: ruff
|
||||||
description: "Run 'ruff' for extremely fast Python linting"
|
description: "Run 'ruff' for extremely fast Python linting"
|
||||||
entry: ruff check --force-exclude
|
entry: ruff check --force-exclude
|
||||||
language: python
|
language: python
|
||||||
'types_or': [python, pyi]
|
"types_or": [python, pyi]
|
||||||
args: []
|
args: []
|
||||||
require_serial: true
|
require_serial: true
|
||||||
additional_dependencies: []
|
additional_dependencies: []
|
||||||
minimum_pre_commit_version: '2.9.2'
|
minimum_pre_commit_version: "2.9.2"
|
||||||
|
- id: ruff-format
|
||||||
|
name: ruff-format
|
||||||
|
description: "Run 'ruff format' for extremely fast Python formatting"
|
||||||
|
entry: ruff format --force-exclude
|
||||||
|
language: python
|
||||||
|
"types_or": [python, pyi]
|
||||||
|
args: []
|
||||||
|
require_serial: true
|
||||||
|
additional_dependencies: []
|
||||||
|
minimum_pre_commit_version: "2.9.2"
|
||||||
|
22
README.md
22
README.md
@ -50,6 +50,28 @@ _unless_ you enable autofix, in which case, Ruff's pre-commit hook should run _b
|
|||||||
and other formatting tools, as Ruff's autofix behavior can output code changes that require
|
and other formatting tools, as Ruff's autofix behavior can output code changes that require
|
||||||
reformatting.
|
reformatting.
|
||||||
|
|
||||||
|
### Using Ruff's formatter (unstable)
|
||||||
|
|
||||||
|
[Ruff's formatter](https://github.com/astral-sh/ruff/blob/main/crates/ruff_python_formatter/README.md) is in Alpha, but can used with pre-commit by adding the `ruff-format` hook:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
|
rev: v0.0.289
|
||||||
|
hooks:
|
||||||
|
- id: ruff-format
|
||||||
|
```
|
||||||
|
|
||||||
|
To check formatting without changing files, use `--check`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
|
# Ruff version.
|
||||||
|
rev: v0.0.289
|
||||||
|
hooks:
|
||||||
|
- id: ruff-format
|
||||||
|
args: [--check]
|
||||||
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
Loading…
Reference in New Issue
Block a user