This repository was archived by the owner on Jun 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
115 lines (105 loc) · 3.03 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
115 lines (105 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
fail_fast: true # Stop on first failure to save time
default_stages: [pre-commit]
repos:
# Python syntax check (fastest, runs first)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-ast
name: Check Python syntax
# Ruff - Auto-fix formatting and linting issues (uses pyproject.toml config)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.10
hooks:
- id: ruff
name: Ruff auto-fix
args: [--fix] # Uses config from pyproject.toml
files: ^(src/|tests/|main\.py)
- id: ruff-format
name: Ruff formatter
files: ^(src/|tests/|main\.py)
# Basic file checks (fast)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-json
- id: check-toml
- id: check-merge-conflict
- id: detect-private-key
- id: debug-statements
# Run ONLY critical tests that must pass
- repo: local
hooks:
- id: critical-checks
name: Critical checks only
entry: bash -c 'echo "Running critical checks..." && uv run python -m py_compile main.py src/*.py 2>/dev/null || (echo "Syntax errors found!" && exit 1)'
language: system
pass_filenames: false
stages: [pre-commit]
# Hooks for manual run or CI only
# Full linting (manual)
- repo: local
hooks:
- id: full-lint
name: Full linting check (same as CI)
entry: bash -c 'uv run ruff check src/ tests/ main.py && uv run ruff format --check src/ tests/ main.py'
language: system
pass_filenames: false
stages: [manual]
# Type checking (run on every commit)
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.17.1
hooks:
- id: mypy
name: Type checking
args: [--config-file=mypy.ini]
additional_dependencies:
- types-PyYAML
- types-requests
- pydantic
- psutil
- numpy
- types-psutil
files: ^(src/|main\.py)
stages: [pre-commit] # Run on every commit
# Tests (push only)
- repo: local
hooks:
- id: tests
name: Run tests
entry: uv run pytest tests/ -q --tb=line --disable-warnings -m "not slow"
language: system
pass_filenames: false
stages: [pre-push]
# Security (push only)
- repo: https://github.com/PyCQA/bandit
rev: 1.8.6
hooks:
- id: bandit
name: Security scan
args: [-c, pyproject.toml, --severity-level, high, -q]
additional_dependencies: ["bandit[toml]"]
files: ^(src/|main\.py)
stages: [pre-push]
exclude: |
(?x)^(
.*\.egg-info/.*|
\.git/.*|
\.mypy_cache/.*|
\.pytest_cache/.*|
\.ruff_cache/.*|
__pycache__/.*|
build/.*|
dist/.*|
data/.*|
logs/.*|
.*\.db$|
.*\.sqlite$|
uv\.lock$
)
default_language_version:
python: python3.11