.pre-commit-config.yamlā¢2.69 kB
# Pre-commit hooks configuration
# See https://pre-commit.com for more information
repos:
# Gitleaks - Secret scanning
- repo: https://github.com/gitleaks/gitleaks
rev: v8.27.2
hooks:
- id: gitleaks
name: Gitleaks - Secret Detection
description: Detect hardcoded secrets like passwords and API keys
entry: gitleaks protect --verbose --redact --staged
language: system
pass_filenames: false
# Python code quality
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
name: Black - Code Formatter
language_version: python3.9
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
hooks:
- id: ruff
name: Ruff - Linter
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
name: Ruff - Formatter
# Python imports sorting
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort - Import Sorting
args: ["--profile", "black", "--filter-files"]
# Type checking (optional - can be slow)
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.13.0
# hooks:
# - id: mypy
# additional_dependencies: [types-all]
# args: [--strict]
# General file checks
- 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 Large Files
args: ['--maxkb=1000']
- id: check-merge-conflict
name: Check for Merge Conflicts
- id: detect-private-key
name: Detect Private Keys
- id: mixed-line-ending
name: Fix Mixed Line Endings
args: ['--fix=lf']
# Security checks
- repo: https://github.com/PyCQA/bandit
rev: 1.8.0
hooks:
- id: bandit
name: Bandit - Security Linter
args: ['-c', 'pyproject.toml']
additional_dependencies: ["bandit[toml]"]
# Configuration for specific hooks
default_language_version:
python: python3.9
# Files to exclude from all hooks
exclude: |
(?x)^(
legacy/.*|
\.git/.*|
\.mypy_cache/.*|
\.pytest_cache/.*|
__pycache__/.*|
\.venv/.*|
venv/.*|
build/.*|
dist/.*
)$
# Fail fast on first error
fail_fast: false
# Minimum pre-commit version
minimum_pre_commit_version: '3.0.0'