72 lines
1.8 KiB
YAML
72 lines
1.8 KiB
YAML
# 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: 23.12.1
|
|
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]
|
|
|
|
# Full test suite with 30-second wall-clock limit.
|
|
# Current baseline: ~18s. If tests get slow, this blocks the commit.
|
|
- repo: local
|
|
hooks:
|
|
- id: pytest-fast
|
|
name: pytest (30s limit)
|
|
entry: timeout 30 poetry run pytest
|
|
language: system
|
|
types: [python]
|
|
stages: [commit]
|
|
pass_filenames: false
|
|
always_run: true
|
|
args:
|
|
- tests
|
|
- -q
|
|
- --tb=short
|
|
- --timeout=10
|
|
verbose: true
|