# Pre-commit hooks configuration for OpenZIM MCP
# See https://pre-commit.com for more information
repos:
# General code quality
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-added-large-files
args: ["--maxkb=1000"]
- id: check-merge-conflict
- id: check-case-conflict
- id: check-docstring-first
- id: debug-statements
- id: name-tests-test
args: ["--pytest-test-first"]
# Python code formatting
- repo: https://github.com/psf/black
rev: 26.1.0
hooks:
- id: black
language_version: python3.12
args: ["--line-length=88", "--target-version=py312"]
# Import sorting
- repo: https://github.com/pycqa/isort
rev: 7.0.0
hooks:
- id: isort
args: ["--profile=black", "--line-length=88"]
# Linting
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
additional_dependencies:
- flake8-docstrings
- flake8-bugbear
- flake8-comprehensions
- flake8-simplify
args: ["--max-line-length=88", "--extend-ignore=E203,W503,D202"]
# Type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.1
hooks:
- id: mypy
files: ^openzim_mcp/
additional_dependencies:
- pydantic
- types-requests
args: ["--python-version=3.12", "--ignore-missing-imports"]
# Security scanning
- repo: https://github.com/PyCQA/bandit
rev: 1.8.0
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]
# Documentation
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args: ["--convention=google", "--add-ignore=D202,D212"]
# Markdown linting
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.42.0
hooks:
- id: markdownlint
args: ["--fix"]
# YAML formatting
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types: [yaml]
args: ["--cache-location", ".cache/prettier"]
# Configuration for specific hooks
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: []
submodules: false