diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..637450b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: + # Mirrors CI: poe lint → `ruff format --check` + `ruff check .` + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.15.13 + hooks: + - id: ruff + exclude: ^bin/ + - id: ruff-format + exclude: ^bin/ + diff --git a/DEVELOP.md b/DEVELOP.md index 482d785..8073ae2 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -32,6 +32,19 @@ Format code: poe format +## Pre-commit hooks + +The repository ships a `.pre-commit-config.yaml` that runs the same linters +as CI (`ruff check` + `ruff format --check`) on every commit. To install: + + pip install pre-commit + pre-commit install + +After that, linting runs automatically before each `git commit`. To run it +manually across all files: + + pre-commit run --all-files + ## Preparing a release