repos:
# Master examples generation (first to ensure consistency)
- repo: local
hooks:
- id: generate-master-examples
name: Generate master example files
entry: bash -c 'source .venv/bin/activate && python scripts/generate_master_examples.py'
language: system
pass_filenames: false
always_run: true
stages: [pre-commit]
# Root directory pollution check (second to catch early)
- repo: local
hooks:
- id: check-root-pollution
name: Check for root directory pollution
entry: bash -c 'source .venv/bin/activate && python scripts/check_root_pollution.py'
language: system
pass_filenames: false
always_run: true
# Auto-formatting (PEP8)
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
args: ["--check", "--line-length=200", "--include", "\\.pyi?$|\\.ipynb$"]
# Linting (logic, unused imports, etc.)
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: ["flake8-bugbear", "flake8-comprehensions"]
args: ["--max-line-length=200", "--ignore=E203,W503,E501,E304,W292"]
# Import sorting
# - repo: https://github.com/pre-commit/mirrors-isort
# rev: v5.10.1
# hooks:
# - id: isort
# args: ["--profile=black"]
# Type checking
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.7.1
# hooks:
# - id: mypy
# Security scanning
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
- id: bandit
args: ["-c", "bandit.yaml"]
# Docstring linting
# - repo: https://github.com/PyCQA/pydocstyle
# rev: 6.3.0
# hooks:
# - id: pydocstyle
# additional_dependencies:
# - tomli>=2.0.1
# Basic file hygiene
# - repo: https://github.com/pre-commit/pre-commit-hooks
# rev: v4.5.0
# hooks:
# - id: end-of-file-fixer
# - id: trailing-whitespace
# - id: check-yaml
# - id: check-added-large-files
# Additional local checks and testing
- repo: local
hooks:
- id: check-no-os-environ
name: Prevent os.environ usage
entry: bash -c 'source .venv/bin/activate && python scripts/check_no_os_environ.py'
language: system
pass_filenames: false
always_run: true
- id: pytest
name: pytest with coverage
entry: bash -c 'source .venv/bin/activate && pytest --cov=src --cov-report=term-missing --cov-fail-under=30 -k "not test_image_integration" --ignore=tests/test_mcp_template_discovery.py --ignore=tests/test_pattern_loader.py --ignore=tests/test_template_metadata.py --ignore=tests/test_template_recommendation.py'
language: system
pass_filenames: false
always_run: true