-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
100 lines (92 loc) · 3.56 KB
/
.pre-commit-config.yaml
File metadata and controls
100 lines (92 loc) · 3.56 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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.13
repos:
# ------------------------------------------------------------------------------
# General hooks
# ------------------------------------------------------------------------------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-added-large-files
args: ["--maxkb=1000"]
- id: check-merge-conflict
- id: detect-private-key
# ------------------------------------------------------------------------------
# Ruff - Linting & Formatting (replaces black, isort, flake8)
# ------------------------------------------------------------------------------
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
hooks:
# Run the linter with auto-fix
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
# Run the formatter
- id: ruff-format
# ------------------------------------------------------------------------------
# Mypy - Type Checking
# ------------------------------------------------------------------------------
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies:
- pydantic>=2.0
- pydantic-settings>=2.0
- sqlalchemy>=2.0
- pytest-asyncio>=0.24
- typer>=0.9.0
- rich>=13.0
- loguru>=0.7.0
- types-python-dateutil>=2.8.0
- githubkit>=0.11.0
- aiosqlite>=0.19.0
- pytest>=8.0
args: [--config-file=pyproject.toml, src, tests]
pass_filenames: false
# Run on both src and tests directories
files: ^(src|tests)/
# ------------------------------------------------------------------------------
# Custom Quality Gates (non-blocking, informational)
# ------------------------------------------------------------------------------
- repo: local
hooks:
# Track type: ignore count (warning, not blocking)
- id: audit-type-ignores
name: Audit type:ignore comments
entry: >
bash -c 'count=$(grep -r "type: ignore" src/ 2>/dev/null | wc -l | tr -d " ");
echo "type:ignore comments in src/: $count (target: <=5)";
[ "$count" -le 5 ] || echo "Consider reducing type:ignore usage"; exit 0'
language: system
pass_filenames: false
always_run: true
verbose: true
# Track noqa count (warning, not blocking)
- id: audit-noqa
name: Audit noqa comments
entry: >
bash -c 'count=$(grep -r "noqa:" src/ 2>/dev/null | wc -l | tr -d " ");
echo "noqa comments in src/: $count (target: <=3)";
[ "$count" -le 3 ] || echo "Consider reducing noqa usage"; exit 0'
language: system
pass_filenames: false
always_run: true
verbose: true
# BLOCK new Any type aliases (excluding legitimate dict[str, Any])
- id: prevent-any-aliases
name: Prevent new Any type aliases
entry: >
bash -c 'if grep -rn "^[A-Z][a-zA-Z]* = Any" src/ 2>/dev/null | grep -v "^Binary";
then echo "Found type alias to Any - use TYPE_CHECKING block instead"; exit 1; fi; exit 0'
language: system
pass_filenames: false
always_run: true
ci:
autoupdate_schedule: weekly
# mypy now runs on both src/ and tests/