# Pre-commit hooks for Medium-MCP # Install: pip install pre-commit && pre-commit install # Run manually: pre-commit run --all-files default_language_version: python: python3.11 repos: # ========================================================================== # Ruff - Fast Python linter and formatter # ========================================================================== - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.8.0 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - id: ruff-format # ========================================================================== # MyPy - Static type checking # ========================================================================== - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.13.0 hooks: - id: mypy args: [--config-file=pyproject.toml] additional_dependencies: - pydantic>=2.0.0 - types-beautifulsoup4>=4.12.0 pass_filenames: false entry: mypy src/ # ========================================================================== # Security - Detect secrets # ========================================================================== - repo: https://github.com/Yelp/detect-secrets rev: v1.5.0 hooks: - id: detect-secrets args: ['--baseline', '.secrets.baseline'] exclude: package.lock.json # ========================================================================== # General file quality # ========================================================================== - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: trailing-whitespace exclude: '\.md$' - id: end-of-file-fixer exclude: '\.md$' - id: check-yaml args: [--unsafe] # Allow custom tags - id: check-toml - id: check-json - id: check-added-large-files args: ['--maxkb=1000'] - id: check-merge-conflict - id: debug-statements - id: mixed-line-ending args: [--fix=lf] # ========================================================================== # Commit message formatting # ========================================================================== - repo: https://github.com/commitizen-tools/commitizen rev: v4.1.0 hooks: - id: commitizen stages: [commit-msg] ci: autofix_commit_msg: "style: auto-fix by pre-commit hooks" autoupdate_commit_msg: "chore: update pre-commit hooks"