-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
104 lines (92 loc) · 2.7 KB
/
.pre-commit-config.yaml
File metadata and controls
104 lines (92 loc) · 2.7 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
# .pre-commit-config.yaml
# Balanced approach: Fast checks on commit, full tests with coverage on push
repos:
# ========================================
# PRE-COMMIT STAGE (Fast, Auto-fixing)
# Runs on every commit
# ========================================
# uv lock file management
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.13
hooks:
- id: uv-lock
stages: [pre-commit]
# Code formatting and linting (FAST + AUTO-FIX)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
stages: [pre-commit]
- id: ruff-format
stages: [pre-commit]
# Basic file hygiene (FAST + AUTO-FIX)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
stages: [pre-commit]
- id: end-of-file-fixer
stages: [pre-commit]
- id: check-toml
stages: [pre-commit]
- id: check-json
stages: [pre-commit]
- id: check-yaml
stages: [pre-commit]
- id: check-merge-conflict
stages: [pre-commit]
- id: check-added-large-files
args: ['--maxkb=1000']
stages: [pre-commit]
- id: debug-statements
stages: [pre-commit]
# ========================================
# PRE-PUSH STAGE (Heavier checks)
# Runs before push
# ========================================
# Security scanning
- repo: https://github.com/PyCQA/bandit
rev: '1.7.9'
hooks:
- id: bandit
args: ['-r', 'src/', '-ll']
pass_filenames: false
types: [python]
stages: [pre-push]
# Full test suite with coverage (same as you had before)
- repo: local
hooks:
- id: pytest-cov
name: pytest with coverage
entry: uv run pytest
language: system
types: [python]
pass_filenames: false
always_run: true
stages: [pre-push] # Moved from pre-commit to pre-push
args: [
--cov=src,
--cov-report=term-missing,
--cov-report=html,
--cov-branch,
--cov-precision=2,
tests/
]
# ========================================
# Configuration
# ========================================
default_language_version:
python: python3.10
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
default_install_hook_types: [pre-commit, pre-push]
default_stages: [pre-commit]