.pre-commit-config.yamlā¢4.25 kB
---
# Pre-commit hooks for code quality and consistency
# Install: uv add --dev pre-commit && uv run pre-commit install
# Run manually: uv run pre-commit run --all-files
# Update hooks: uv run pre-commit autoupdate
default_language_version:
python: python3
repos:
# Git workflow enforcement
# - repo: https://github.com/compilerla/conventional-pre-commit
# rev: v3.4.0
# hooks:
# - id: conventional-pre-commit
# stages: [commit-msg]
# args: [optional, feat, fix, docs, test, refactor, chore, ci,
# build]
# Prevent direct commits to main branch
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: no-commit-to-branch
args: ['--branch', 'main', '--branch', 'master']
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-toml
- id: check-vcs-permalinks
- id: check-yaml
args: ['--unsafe']
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: fix-encoding-pragma
args: ['--remove']
- id: mixed-line-ending
args: ['--fix=lf']
- id: name-tests-test
args: ['--pytest-test-first']
- id: trailing-whitespace
# Python linting and formatting with Ruff
# (replaces Black, isort, bandit, etc.)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.1
hooks:
- id: ruff
args: ['--fix', '--exit-non-zero-on-fix']
- id: ruff-format
# Type checking with MyPy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
hooks:
- id: mypy
additional_dependencies:
- pandas-stubs>=2.2.3
- types-aiofiles>=24.1.0.20250822
- types-chardet>=5.0.4.6
- types-jsonschema>=4.25.1.20250822
- types-psutil>=7.0.0.20250822
- types-tabulate>=0.9.0.20241207
- types-pytz>=2025.2.0.20250809
- pydantic>=2.0.0
- pydantic-settings>=2.0.0
- simpleeval>=1.0.3
- fastmcp>=0.1.0
- pandera>=0.22.0
- smithery>=0.4.2
- .
args: ['--config-file', 'pyproject.toml']
pass_filenames: true
# YAML linting with yamllint
- repo: https://github.com/adrienverge/yamllint
rev: v1.37.1
hooks:
- id: yamllint
args: [--format, parsable, --strict]
exclude: "^(.github/workflows/|docs/blog/)"
# Markdown formatting and linting (Python-based)
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.22
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm
- mdformat-frontmatter
- mdformat-ruff
args: [--wrap=80]
# exclude: ^(CODE_OF_CONDUCT\.md|CONTRIBUTING\.md|docs/blog/).*
- repo: https://github.com/jackdewinter/pymarkdown
rev: v0.9.32
hooks:
- id: pymarkdown
args: ["--config", ".pymarkdownlnt", "scan"]
# exclude: ^(CODE_OF_CONDUCT\.md|CONTRIBUTING\.md|docs/blog/).*
# MCP documentation standards enforcement
- repo: local
hooks:
- id: check-docstring-args
name: check-docstring-args
entry: ./scripts/check_docstring_args.py
language: script
files: ^src/.*\.py$
description: >-
Check for Args sections in docstrings
(MCP tools use Field descriptions)
- id: check-mcp-field-descriptions
name: check-mcp-field-descriptions
entry: ./scripts/check_mcp_field_descriptions.py
language: script
files: ^src/.*\.py$
description: >-
Check that all MCP tool parameters have Field descriptions
ci:
autofix_prs: true
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit hooks
for more information, see https://pre-commit.ci
autoupdate_schedule: weekly
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'