# Pre-commit hooks for World Anvil MCP Server
# See https://pre-commit.com for more information
repos:
# Ruff - Fast Python linter and formatter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
hooks:
# Run ruff linter
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
types_or: [python, pyi]
# Run ruff formatter
- id: ruff-format
types_or: [python, pyi]
# MyPy - Static type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies:
- pydantic>=2.0.0
- httpx>=0.27.0
- types-cachetools
args: [--strict, --show-error-codes]
exclude: ^tests/
# Pytest - Run unit tests only (fast)
- repo: local
hooks:
- id: pytest-unit
name: pytest (unit tests only)
entry: pytest
language: system
args: [-m, unit, --tb=short]
pass_filenames: false
always_run: true
# General file hygiene
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
# Prevent commits to main/master
- id: no-commit-to-branch
args: [--branch, main, --branch, master]
# Fix trailing whitespace
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
# Ensure files end with newline
- id: end-of-file-fixer
# Check for merge conflicts
- id: check-merge-conflict
# Check YAML syntax
- id: check-yaml
args: [--safe]
# Check TOML syntax
- id: check-toml
# Check for large files
- id: check-added-large-files
args: [--maxkb=500]
# Detect private keys
- id: detect-private-key
# Check for secrets
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
args: [--baseline, .secrets.baseline]
exclude: package.lock.json
# Configuration
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: [pytest-unit]
submodules: false