# Pre-commit hooks for Ludus MCP
# See https://pre-commit.com for more information
repos:
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-json
- id: check-toml
- id: check-merge-conflict
- id: detect-private-key
- id: mixed-line-ending
# Python code formatting with Black
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
language_version: python3.11
args: ['--line-length=100']
# Python linting with Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: ['--fix', '--exit-non-zero-on-fix']
# Import sorting
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ['--profile', 'black', '--line-length', '100']
# Type checking with mypy (optional - can be slow)
# Uncomment to enable
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.7.1
# hooks:
# - id: mypy
# additional_dependencies:
# - types-all
# args: ['--ignore-missing-imports', '--no-strict-optional']
# Security checks
- repo: https://github.com/PyCQA/bandit
rev: 1.7.6
hooks:
- id: bandit
args: ['-c', 'pyproject.toml']
additional_dependencies: ['bandit[toml]']
# Dockerfile linting (if you have Dockerfiles)
# - repo: https://github.com/hadolint/hadolint
# rev: v2.12.1-beta
# hooks:
# - id: hadolint-docker
# Markdown linting
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.38.0
hooks:
- id: markdownlint
args: ['--fix']
# Configuration for specific hooks
default_language_version:
python: python3.11
# Files to exclude from all hooks
exclude: |
(?x)^(
\.venv/|
venv/|
\.git/|
\.mypy_cache/|
\.pytest_cache/|
__pycache__/|
.*\.pyc$|
.*\.pyo$
)$
# Global settings
fail_fast: false