1+ minimum_pre_commit_version : ' 3.5.0'
2+ default_stages : [pre-commit]
3+ default_language_version :
4+ python : python3.12
5+ node : system
6+
7+ fail_fast : false
8+
19repos :
210 # ============================================================================
311 # BASIC FILE QUALITY CHECKS (baseline hygiene)
@@ -22,58 +30,81 @@ repos:
2230 - id : name-tests-test
2331 args : ["--pytest-test-first"]
2432 exclude : ^tests/(utils|conftest)\.py$
33+ - id : fix-byte-order-marker
34+ - id : detect-private-key
2535
2636 # ============================================================================
27- # CODE FORMATTING (minimal - consistency only, not quality)
28- # Order matters: isort must run before black to avoid conflicts
37+ # GITHUB ACTIONS VALIDATION
38+ # ============================================================================
39+ - repo : https://github.com/python-jsonschema/check-jsonschema
40+ rev : 0.35.0
41+ hooks :
42+ - id : check-github-workflows
43+ name : Validate GitHub workflows
44+ args : ['--verbose']
45+ - id : check-dependabot
46+ name : Validate Dependabot config
47+
48+ - repo : https://github.com/rhysd/actionlint
49+ rev : v1.7.8
50+ hooks :
51+ - id : actionlint
52+ name : Lint GitHub Actions
53+
54+ # ============================================================================
55+ # CODE FORMATTING (Order: isort → black to avoid conflicts)
2956 # ============================================================================
3057 - repo : https://github.com/pycqa/isort
31- rev : 5.13.2
58+ rev : 7.0.0
3259 hooks :
3360 - id : isort
3461
3562 - repo : https://github.com/psf/black
36- rev : 25.9 .0
63+ rev : 25.1 .0
3764 hooks :
3865 - id : black
3966 language_version : python3
4067
68+ - repo : https://github.com/asottile/pyupgrade
69+ rev : v3.21.1
70+ hooks :
71+ - id : pyupgrade
72+ name : pyupgrade (auto-upgrade Python syntax)
73+ args : ['--py312-plus']
74+ files : ^src/.*\.py$
75+
4176 # ============================================================================
42- # STATIC TYPING (proven to reduce TypeError/AttributeError in production)
43- # Evidence: Dropbox/Instagram case studies show 15-40% reduction in type errors
77+ # STATIC TYPING
4478 # ============================================================================
4579 - repo : https://github.com/pre-commit/mirrors-mypy
4680 rev : v1.18.2
4781 hooks :
4882 - id : mypy
49- name : mypy (strict mode for code health)
50- # Runtime deps + stubs needed for mypy's isolated virtualenv
83+ name : mypy (strict mode)
5184 additional_dependencies :
5285 - types-PyYAML
5386 - PyYAML
5487 - pathspec
5588 files : ^src/
5689
90+ # ============================================================================
91+ # LINTING (Ruff for speed + correctness)
92+ # ============================================================================
93+ - repo : https://github.com/astral-sh/ruff-pre-commit
94+ rev : v0.14.0
95+ hooks :
96+ - id : ruff
97+ name : ruff (correctness-focused checks)
98+ args : ["--fix", "--unsafe-fixes"]
99+
57100 # ============================================================================
58101 # SECURITY & VULNERABILITY DETECTION
59- # Evidence: CVE databases with reproducible advisories
60102 # ============================================================================
61103 - repo : https://github.com/trailofbits/pip-audit
62104 rev : v2.9.0
63105 hooks :
64106 - id : pip-audit
65107 name : pip-audit (CVE detection in dependencies)
66- # CVE Ignores Documentation:
67- # - GHSA-4xh5-x5gv-qwph (CVE-2025-8869): pip tar extraction path traversal.
68- # Fix planned for pip 25.3 (not yet released). Low risk: requires attacker-controlled
69- # sdist AND Python < 3.11.4. Project uses Python 3.9+ with modern interpreters.
70- # Review after pip 25.3 release.
71- # - GHSA-gm62-xv2j-4w53 (CVE-2025-66418): urllib3 decompression chain DoS.
72- # Fixed in urllib3 2.6.0. Transitive dependency from pip-audit itself.
73- # Project pins urllib3>=2.6.0 in pyproject.toml.
74- # - GHSA-2xpw-w6gg-jr37 (CVE-2025-66471): urllib3 highly compressed data handling.
75- # Fixed in urllib3 2.6.0. Transitive dependency from pip-audit itself.
76- # Project pins urllib3>=2.6.0 in pyproject.toml.
77108 args :
78109 [
79110 " --desc" ,
@@ -93,12 +124,14 @@ repos:
93124 - id : detect-secrets
94125 args : ["--baseline", ".secrets.baseline"]
95126
96- # ============================================================================
97- # SEMANTIC SECURITY ANALYSIS (replaces basic Bandit)
98- # Evidence: Testable rulepacks, widely adopted in SAST programs
99- # ============================================================================
127+ - repo : https://github.com/gitleaks/gitleaks
128+ rev : v8.29.0
129+ hooks :
130+ - id : gitleaks
131+ name : Scan for secrets (gitleaks)
132+
100133 - repo : https://github.com/returntocorp/semgrep
101- rev : v1.89 .0
134+ rev : v1.99 .0
102135 hooks :
103136 - id : semgrep
104137 name : semgrep (AST-based security & policy)
@@ -113,8 +146,7 @@ repos:
113146 files : ^src/
114147
115148 # ============================================================================
116- # DEAD CODE DETECTION (reduces attack surface & maintenance burden)
117- # Evidence: Direct verification - unused code is measurably wasteful
149+ # DEAD CODE DETECTION
118150 # ============================================================================
119151 - repo : https://github.com/jendrikseipp/vulture
120152 rev : v2.14
@@ -126,9 +158,7 @@ repos:
126158 pass_filenames : false
127159
128160 # ============================================================================
129- # CODE DUPLICATION DETECTION (reduces maintenance burden & bug propagation)
130- # Evidence: Studies show duplicated code increases bug density by 2-3x
131- # Detects copy-pasted code blocks that should be refactored into functions
161+ # CODE DUPLICATION DETECTION
132162 # ============================================================================
133163 - repo : https://github.com/PyCQA/pylint
134164 rev : v4.0.1
@@ -147,29 +177,17 @@ repos:
147177 files : ^src/
148178
149179 # ============================================================================
150- # LINTING (focused on correctness, not style)
151- # Using Ruff for speed; flake8 removed to avoid redundancy
152- # ============================================================================
153- - repo : https://github.com/astral-sh/ruff-pre-commit
154- rev : v0.14.0
155- hooks :
156- - id : ruff
157- name : ruff (correctness-focused checks)
158- args : ["--fix", "--unsafe-fixes"]
159-
160- # ============================================================================
161- # SPELL CHECKING (reduces documentation defects)
180+ # SPELL CHECKING
162181 # ============================================================================
163182 - repo : https://github.com/codespell-project/codespell
164183 rev : v2.4.1
165184 hooks :
166185 - id : codespell
167- args :
168- ["--write-changes", "--ignore-words-list=crate,nd,ser,llm,async,cli,theses,datas"]
186+ args : ["--write-changes", "--ignore-words-list=crate,nd,ser,llm,async,cli,theses,datas"]
169187 exclude : ^(\.git/|\.venv/|venv/)
170188
171189 # ============================================================================
172- # YAML/JSON LINTING
190+ # YAML LINTING
173191 # ============================================================================
174192 - repo : https://github.com/adrienverge/yamllint
175193 rev : v1.37.1
@@ -182,6 +200,34 @@ repos:
182200 {line-length: {max: 120}, document-start: disable,
183201 indentation: disable, comments: disable}}
184202
203+ # ============================================================================
204+ # SHELL LINTING
205+ # ============================================================================
206+ - repo : https://github.com/scop/pre-commit-shfmt
207+ rev : v3.12.0-2
208+ hooks :
209+ - id : shfmt
210+ name : shfmt (shell script formatting)
211+ args : [-w, -i, '2']
212+
213+ - repo : https://github.com/shellcheck-py/shellcheck-py
214+ rev : v0.11.0.1
215+ hooks :
216+ - id : shellcheck
217+ name : shellcheck (shell script linting)
218+ args : [-x]
219+
220+ # ============================================================================
221+ # MARKDOWN LINTING
222+ # ============================================================================
223+ - repo : https://github.com/igorshubovych/markdownlint-cli
224+ rev : v0.45.0
225+ hooks :
226+ - id : markdownlint
227+ name : Lint Markdown files
228+ args : ['--fix']
229+ files : \.(md|markdown)$
230+
185231 # ============================================================================
186232 # COMMIT MESSAGE QUALITY
187233 # ============================================================================
@@ -190,18 +236,3 @@ repos:
190236 hooks :
191237 - id : commitizen
192238 stages : [commit-msg]
193-
194- # ============================================================================
195- # TOOLS DEFERRED TO CI (too slow or complex for pre-commit)
196- # ============================================================================
197- # - CodeQL: GitHub-specific, requires workflow setup
198- # - Pysa: Requires framework-specific taint configuration
199- # - SonarQube/Cloud: Platform-based, not a hook
200- # - Radon: No official pre-commit hook, run via pip in CI
201- # - Hypothesis: Property-based testing, runs with pytest in CI
202- # - Mutation testing (mutmut/Cosmic Ray): Too slow, CI only
203- # - Coverage: Measured in CI with pytest-cov
204- # - Import Linter: Requires project-specific contract definition
205- # - Atheris/CrossHair: Fuzzing/symbolic execution - CI only
206- #
207- # See .github/workflows/ci.yml for integration of these tools
0 commit comments