.pre-commit-config.yaml•2.09 kB
# Pre-commit hooks configuration
# https://pre-commit.com
#
# Install pre-commit hooks:
# uv pip install pre-commit
# pre-commit install
#
# Run manually:
# pre-commit run --all-files
repos:
# Pre-commit hooks
- 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: check-case-conflict
- 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.3.0
hooks:
# Run the linter
- id: ruff
args: [--fix]
# Run the formatter
- id: ruff-format
# MyPy - Static type checker (disabled in pre-commit, runs in CI)
# Note: Disabled because pre-commit's isolated environment doesn't match CI
# and causes false positives with type: ignore comments
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.9.0
# hooks:
# - id: mypy
# args: [--ignore-missing-imports, --no-strict-optional, --no-warn-return-any]
# additional_dependencies:
# - types-requests
# - types-setuptools
# - pydantic
# - pydantic-settings
# files: ^src/
# exclude: ^tests/
# Security checks
- repo: https://github.com/PyCQA/bandit
rev: 1.7.8
hooks:
- id: bandit
args: [-ll, --skip=B101]
files: ^src/
# Configuration
default_language_version:
python: python3.11
# Run hooks on commit
default_stages: [pre-commit]
# Exclude directories
exclude: |
(?x)(
^\.git/|
^\.venv/|
^venv/|
^env/|
^build/|
^dist/|
^\.eggs/|
^\.pytest_cache/|
^\.mypy_cache/|
^\.ruff_cache/|
^\.tox/|
^__pycache__/|
^\.linkedin_drafts/|
^htmlcov/|
^\.coverage|
coverage\.xml|
coverage\.json
)