.pre-commit-config.yaml•2.49 kB
# Pre-commit configuration for Keap MCP service
# Ensures code quality and security before commits
repos:
# Code formatting
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
language_version: python3.11
args: [--line-length=100]
# Import sorting
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: [--profile=black, --line-length=100]
# Linting
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [--max-line-length=100, --ignore=E203,W503]
additional_dependencies: [flake8-docstrings]
# Security scanning
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
- id: bandit
args: [-r, src/, -f, json, -o, bandit-report.json]
pass_filenames: false
# Basic file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
args: [--maxkb=1000]
- id: detect-private-key
# Dockerfile linting
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
- id: hadolint-docker
args: [--ignore, DL3008, --ignore, DL3009]
# Shell script checking
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.5
hooks:
- id: shellcheck
args: [-x]
# Type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.0
hooks:
- id: mypy
args: [--ignore-missing-imports, --no-strict-optional]
additional_dependencies: [types-requests, types-python-dateutil]
# Documentation
- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args: [--convention=google]
# Secrets detection
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
args: [--baseline, .secrets.baseline]
# Global configuration
default_language_version:
python: python3.11
# Exclude patterns
exclude: |
(?x)^(
migrations/|
\.git/|
\.tox/|
\.venv/|
_build/|
buck-out/|
build/|
dist/|
\.egg-info/|
__pycache__/|
\.pytest_cache/|
\.coverage|
coverage\.xml|
\.mypy_cache/|
reports/|
TO_BE_DELETED/
)$