# mcpstat - Usage tracking and analytics for MCP servers.
#
# File Details:
# - Purpose: Pre-commit hooks for mcpstat
# - Functionality: Automatic code quality checks and formatting before commits.
#
# Installation:
# - Install pre-commit: pip install pre-commit
# - Install hooks: pre-commit install
# - Run manually: pre-commit run --all-files
#
# Information:
# - See https://pre-commit.com for more information
#
# Repository: https://github.com/tekkidev/mcpstat
# PyPI: https://pypi.org/project/mcpstat
#
# Author: Vadim Bakhrenkov
# Copyright: 2026 Vadim Bakhrenkov
# License: MIT License
default_language_version:
python: python3
repos:
# Standard pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--unsafe]
- id: check-toml
- id: check-json
- id: check-added-large-files
args: ['--maxkb=1024']
- id: check-case-conflict
- id: check-merge-conflict
- id: detect-private-key
- id: check-executables-have-shebangs
- id: check-ast
- id: debug-statements
- id: mixed-line-ending
args: [--fix=lf]
# Ruff - fast Python linter and formatter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.4
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
# Type checking with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
args: [--ignore-missing-imports]
additional_dependencies: []
exclude: ^(tests/|examples/)
# Security checks with bandit
- repo: https://github.com/PyCQA/bandit
rev: 1.8.0
hooks:
- id: bandit
args: ['-c', 'pyproject.toml', '-r', 'mcpstat/']
additional_dependencies: ['bandit[toml]']
exclude: ^tests/
# Local hooks for project-specific checks
- repo: local
hooks:
- id: pytest-check
name: pytest quick check
entry: python -m pytest tests/ -q --tb=no
language: system
pass_filenames: false
always_run: true
stages: [pre-commit]
ci:
autofix_commit_msg: '[pre-commit.ci] auto fixes from pre-commit.com hooks'
autofix_prs: true
autoupdate_branch: 'main'
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: [pytest-check]