# Pre-commit hooks for local development
# Install: pip install pre-commit
# Setup: pre-commit install
# Run manually: pre-commit run --all-files
repos:
# Linting + formatting (ruff replaces black + isort + bandit)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.7
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
# Type checking (optional - can be slow)
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
- id: mypy
additional_dependencies: [types-all]
args: [--ignore-missing-imports, --no-error-summary]
exclude: ^tests/
stages: [manual]
# YAML validation
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
- id: check-yaml
- id: check-json
- id: check-toml
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict
- id: debug-statements
- id: mixed-line-ending
# Format + unit tests via tox (30s wall-clock limit).
# Runs tox pre-commit env; full suite runs in CI.
- repo: local
- id: tox-pre-commit
name: tox pre-commit (format + unit tests)
entry: tox -e pre-commit
language: system
types: [python]
stages: [pre-commit]
pass_filenames: false
always_run: true
verbose: true