Add alpha formatter support (#50)
This commit is contained in:
parent
9845d84394
commit
caa92debff
@ -3,8 +3,18 @@
|
||||
description: "Run 'ruff' for extremely fast Python linting"
|
||||
entry: ruff check --force-exclude
|
||||
language: python
|
||||
'types_or': [python, pyi]
|
||||
"types_or": [python, pyi]
|
||||
args: []
|
||||
require_serial: true
|
||||
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
|
||||
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
|
||||
|
||||
MIT
|
||||
|
Loading…
Reference in New Issue
Block a user