.pre-commit-config.yaml•2.85 kB
# Modern pre-commit configuration for 2024-2025
# See https://pre-commit.com for more information
repos:
# Ruff - Ultra-fast Python linter and formatter (replaces flake8, isort, and more)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.4
hooks:
- id: ruff
name: ruff (linter)
args: [--fix, --exit-non-zero-on-fix]
types_or: [python, pyi, jupyter]
- id: ruff-format
name: ruff (formatter)
types_or: [python, pyi, jupyter]
# Mypy - Static type checker
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.17.0
hooks:
- id: mypy
additional_dependencies:
- types-python-dateutil
- types-setuptools
- pydantic>=2.0.0
args:
- --no-strict-optional
- --show-error-codes
- --install-types
- --non-interactive
- --ignore-missing-imports
- --disable-error-code=unreachable
- --disable-error-code=no-untyped-def
types: [python]
# Bandit - Security linter
- repo: https://github.com/PyCQA/bandit
rev: 1.8.6
hooks:
- id: bandit
args: [-c, pyproject.toml]
additional_dependencies: ["bandit[toml]"]
types: [python]
# General pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
name: trim trailing whitespace
- id: end-of-file-fixer
name: fix end of files
- id: check-yaml
name: check yaml syntax
- id: check-toml
name: check toml syntax
- id: check-json
name: check json syntax
- id: check-added-large-files
name: check for added large files
args: ['--maxkb=1000']
- id: check-merge-conflict
name: check for merge conflicts
- id: debug-statements
name: debug statements (Python)
- id: check-docstring-first
name: check docstring is first
# Local CI Simulation (pre-push hook)
- repo: local
hooks:
- id: ci-simulation
name: Run CI simulation before push
entry: ./scripts/check-ci.sh
language: script
stages: [pre-push]
pass_filenames: false
always_run: true
# Conventional commits (optional but recommended)
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.5.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [--strict]
# Global configuration
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: []
submodules: false