# Pre-commit hooks for local development # Install: pip install pre-commit # Setup: pre-commit install # Run manually: pre-commit run --all-files repos: # Code formatting - repo: https://github.com/psf/black rev: 26.3.0 hooks: - id: black language_version: python3.11 args: [--line-length=100] # Import sorting - repo: https://github.com/PyCQA/isort rev: 5.13.2 hooks: - id: isort args: [--profile=black, --line-length=100] # Type checking (optional - can be slow) - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.7.1 hooks: - 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 hooks: - 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 # Security checks (optional) - repo: https://github.com/PyCQA/bandit rev: 1.7.5 hooks: - id: bandit args: [-ll, --skip, B101,B601] exclude: ^tests/ stages: [manual] # Format + unit tests via tox (30s wall-clock limit). # Runs tox pre-commit env; full suite runs in CI. - repo: local hooks: - 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