-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
359 lines (325 loc) · 10.2 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
359 lines (325 loc) · 10.2 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# Pre-commit configuration for Bloodhound Virtual Machine
# Consciousness-Aware Scientific Computing Platform
repos:
# === General Purpose Hooks ===
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
exclude: '\.ipynb$'
- id: check-yaml
args: [--multi]
- id: check-toml
- id: check-json
exclude: '\.ipynb$'
- id: check-xml
- id: check-merge-conflict
- id: check-case-conflict
- id: check-symlinks
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-docstring-first
- id: debug-statements
- id: name-tests-test
args: [--pytest-test-first]
- id: requirements-txt-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: pretty-format-json
args: [--autofix, --no-sort-keys]
exclude: '\.ipynb$'
# === Rust Formatting and Linting ===
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
name: Rust Format
description: Format Rust code with rustfmt
entry: rustfmt
language: system
files: \.rs$
args: [--edition, "2021"]
- id: clippy
name: Rust Clippy
description: Lint Rust code with clippy
entry: cargo
language: system
args: [clippy, --all-targets, --all-features, --, -D, warnings]
files: \.rs$
pass_filenames: false
# === Python Formatting and Linting ===
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
name: Python Black Formatter
description: Format Python code with Black
language_version: python3
args: [--line-length=88]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: Python Import Sorter
description: Sort Python imports with isort
args: [--profile, black, --line-length=88]
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
name: Python Flake8 Linter
description: Lint Python code with flake8
additional_dependencies:
- flake8-docstrings
- flake8-typing-imports
- flake8-bugbear
- flake8-comprehensions
- flake8-simplify
args: [--max-line-length=88, --extend-ignore=E203,W503]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
hooks:
- id: mypy
name: Python Type Checker
description: Check Python types with mypy
additional_dependencies:
- types-requests
- types-PyYAML
- types-toml
args: [--ignore-missing-imports, --disallow-untyped-defs]
# === Security Checks ===
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
- id: bandit
name: Python Security Scanner
description: Scan Python code for security issues
args: [-r, ., -f, json, -o, bandit-report.json]
exclude: tests/
- repo: https://github.com/gitguardian/ggshield
rev: v1.25.0
hooks:
- id: ggshield
name: GitGuardian Security Scanner
description: Scan for secrets and security vulnerabilities
language: python
stages: [commit]
# === Documentation ===
- repo: https://github.com/myint/docformatter
rev: v1.7.5
hooks:
- id: docformatter
name: Python Docstring Formatter
description: Format Python docstrings
args: [--in-place, --wrap-summaries=88, --wrap-descriptions=88]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
name: Python Docstring Checker
description: Check Python docstring conventions
args: [--convention=google]
# === Markdown and Documentation ===
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.37.0
hooks:
- id: markdownlint
name: Markdown Linter
description: Lint Markdown files
args: [--fix]
exclude: 'docs/virtual-machine/.*\.md$' # Exclude our scientific docs
# === YAML Formatting ===
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
name: Prettier Formatter
description: Format YAML, JSON, and other files
types_or: [yaml, json]
exclude: '\.ipynb$'
# === Shell Script Linting ===
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck
name: Shell Script Linter
description: Lint shell scripts with shellcheck
# === Docker ===
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
- id: hadolint-docker
name: Dockerfile Linter
description: Lint Dockerfile with hadolint
# === Configuration File Validation ===
- repo: https://github.com/adrienverge/yamllint
rev: v1.33.0
hooks:
- id: yamllint
name: YAML Linter
description: Lint YAML files
args: [-d, relaxed]
# === License and Copyright ===
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
- id: insert-license
name: Insert License Header
files: \.rs$
args:
- --license-filepath
- LICENSE_HEADER.txt
- --comment-style
- //
# === Rust-specific Security and Quality ===
- repo: local
hooks:
- id: cargo-check
name: Cargo Check
description: Check Rust code compilation
entry: cargo
language: system
args: [check, --all-targets, --all-features]
files: \.rs$
pass_filenames: false
- id: cargo-test
name: Cargo Test
description: Run Rust unit tests
entry: cargo
language: system
args: [test, --lib, --all-features]
files: \.rs$
pass_filenames: false
- id: cargo-audit
name: Cargo Security Audit
description: Audit Rust dependencies for security vulnerabilities
entry: cargo
language: system
args: [audit]
files: Cargo\.(toml|lock)
pass_filenames: false
# === Python-specific Quality Checks ===
- repo: local
hooks:
- id: python-safety
name: Python Safety Check
description: Check Python dependencies for security vulnerabilities
entry: safety
language: python
args: [check, --json, --output, safety-report.json]
files: requirements.*\.txt$
pass_filenames: false
- id: pytest-unit
name: Python Unit Tests
description: Run Python unit tests
entry: python
language: system
args: [-m, pytest, python/tests/, -x, -v, --tb=short]
files: \.py$
pass_filenames: false
# === Consciousness-Aware VM Specific Checks ===
- repo: local
hooks:
- id: consciousness-validation
name: Consciousness Logic Validation
description: Validate consciousness-level processing logic
entry: python
language: system
args: [scripts/validate_consciousness_logic.py]
files: (consciousness|bmd|frame_selection).*\.py$
pass_filenames: false
- id: s-entropy-validation
name: S-Entropy Mathematics Validation
description: Validate S-entropy navigation mathematics
entry: python
language: system
args: [scripts/validate_s_entropy_math.py]
files: (s_entropy|navigation|coordinate).*\.(py|rs)$
pass_filenames: false
- id: purpose-framework-validation
name: Purpose Framework Validation
description: Validate Purpose Framework domain learning logic
entry: python
language: system
args: [scripts/validate_purpose_framework.py]
files: (purpose|domain|learning|lora).*\.(py|rs)$
pass_filenames: false
- id: combine-harvester-validation
name: Combine Harvester Validation
description: Validate Combine Harvester integration logic
entry: python
language: system
args: [scripts/validate_combine_harvester.py]
files: (combine|harvester|integration|synthesis).*\.(py|rs)$
pass_filenames: false
- id: scientific-correctness
name: Scientific Correctness Check
description: Validate scientific computation correctness
entry: python
language: system
args: [scripts/validate_scientific_correctness.py]
files: (genomics|proteomics|metabolomics|bioinformatics).*\.(py|rs)$
pass_filenames: false
# === Configuration Validation ===
- repo: local
hooks:
- id: bloodhound-config-validation
name: Bloodhound Configuration Validation
description: Validate Bloodhound VM configuration
entry: python
language: system
args: [scripts/validate_bloodhound_config.py]
files: bloodhound.*\.toml$
pass_filenames: false
- id: docker-compose-validation
name: Docker Compose Validation
description: Validate Docker Compose configuration
entry: docker-compose
language: system
args: [config, -q]
files: docker-compose.*\.yml$
pass_filenames: false
# Pre-commit configuration
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: [cargo-audit, python-safety, pytest-unit] # Skip slow hooks in CI
submodules: false
# Default language version
default_language_version:
python: python3.11
rust: '1.70'
# Exclude patterns
exclude: |
(?x)^(
\.git/.*|
\.venv/.*|
venv/.*|
target/.*|
build/.*|
dist/.*|
.*\.egg-info/.*|
__pycache__/.*|
\.pytest_cache/.*|
\.mypy_cache/.*|
\.coverage.*|
htmlcov/.*|
\.ipynb_checkpoints/.*|
docs/_build/.*|
models/.*\.bin|
models/.*\.onnx|
data/.*|
logs/.*|
.*\.log|
.*\.bak|
.*\.backup
)$
# Minimum pre-commit version
minimum_pre_commit_version: 3.5.0