Add pre-commit hook (#55)

This commit is contained in:
Ariel Richtman
2022-09-02 03:01:28 +10:00
committed by GitHub
parent 5a3092e805
commit 4f42f51bd2
3 changed files with 22 additions and 0 deletions

5
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/charliermarsh/ruff
rev: v0.0.23
hooks:
- id: lint

7
.pre-commit-hooks.yaml Normal file
View File

@@ -0,0 +1,7 @@
- id: lint
name: ruff lint
description: Run ruff to lint Python files.
entry: ruff
language: python
types_or: [python]
pass_filenames: true

View File

@@ -51,6 +51,16 @@ You can run ruff in `--watch` mode to automatically re-run on-change:
ruff path/to/code/ --watch
```
ruff also works with [Pre-Commit](https://pre-commit.com) (requires Cargo on system):
```yaml
repos:
- repo: https://github.com/charliermarsh/ruff
rev: v0.0.23
hooks:
- id: lint
```
## Configuration
ruff is configurable both via `pyproject.toml` and the command line.