-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
154 lines (142 loc) · 5.49 KB
/
.pre-commit-config.yaml
File metadata and controls
154 lines (142 loc) · 5.49 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
# Opifex Pre-commit Configuration
# Enhanced with workshop insights for comprehensive code quality
# Optimized for performance and reduced package installations
repos:
# Workshop-inspired TOML formatting
- repo: local
hooks:
- id: sort_pyproject
name: sort_pyproject
entry: toml-sort
language: python
args: [-i, --sort-table-keys, --sort-inline-tables, pyproject.toml]
files: ^pyproject\.toml$
additional_dependencies: ["toml-sort==0.23.1"]
# Standard pre-commit hooks with scientific computing adaptations
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
- id: end-of-file-fixer
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
- id: check-yaml
exclude: ^(memory-bank|documents|custom_modes|.cursor)/(.*)|mkdocs\.yml$
- id: check-added-large-files
args: ["--maxkb=2000"] # Increased for scientific data files
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
- id: check-merge-conflict
- id: check-toml
- id: check-json
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
- id: debug-statements
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
- id: mixed-line-ending
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
# Workshop-inspired comprehensive Python linting and formatting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.13
hooks:
- id: ruff # linter with scientific computing optimizations (auto-fix)
args: [--fix]
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
types_or: [python, pyi, jupyter, toml]
- id: ruff-format # formatter
types_or: [python, pyi, jupyter, toml]
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
# GitHub Actions simulation - exact mirror of CI checks
- repo: local
hooks:
- id: ruff-github-actions-check
name: ruff-github-actions-check (mirrors CI)
entry: uv run ruff check --output-format=github
language: system
types: [python]
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
pass_filenames: false
always_run: true
- id: ruff-critical-check
name: ruff-critical-check (fast CI-critical rules only)
entry: uv run ruff check --select=RUF005,B904,F821,F822,F823 --output-format=github
language: system
types: [python]
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
pass_filenames: false
always_run: true
- id: check-file-length
name: check-file-length (warn >1500, fail >2000 lines)
entry: bash
args:
- -c
- |
for file in "$@"; do
lines=$(wc -l < "$file" 2>/dev/null || echo 0)
if [ "$lines" -gt 2000 ]; then
echo "ERROR: $file has $lines lines (limit: 2000)"
exit 1
elif [ "$lines" -gt 1500 ]; then
echo "WARNING: $file has $lines lines (approaching limit of 2000)"
fi
done
- --
language: system
types: [python]
exclude: ^(memory-bank|documents|custom_modes|.cursor|tests/|examples/)
# Type checking using project venv (ensures all deps including datarax are available)
- repo: local
hooks:
- id: pyright
name: pyright
entry: uv run pyright --warnings
language: system
types: [python]
pass_filenames: false
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
# Workshop-inspired security scanning
- repo: https://github.com/PyCQA/bandit
rev: 1.8.3
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
exclude: ^(memory-bank|documents|custom_modes|.cursor|tests/)/
additional_dependencies: ["bandit[toml]"]
# Workshop-inspired documentation quality
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
exclude: ^(memory-bank|documents|custom_modes|.cursor|tests/)/
additional_dependencies: ["pydocstyle[toml]"]
args: ["--config=pyproject.toml"]
# Workshop-inspired notebook quality
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.1
hooks:
- id: nbqa-ruff
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
args: [--fix]
# Workshop-inspired shell script quality
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
exclude: ^(memory-bank|documents|custom_modes|.cursor)/
args: ["-e", "SC1091"] # Allow sourcing files not found by shellcheck
# Workshop-inspired Dockerfile quality (if we add Docker later)
# Temporarily disabled due to installation issues
# - repo: https://github.com/hadolint/hadolint
# rev: v2.13.1-beta
# hooks:
# - id: hadolint-docker
# exclude: ^(memory-bank|documents|custom_modes|.cursor)/
# CI Configuration - no autofix, manual testing before commits
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: false # No automatic commits - run tests manually first
autoupdate_branch: ""
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
autoupdate_schedule: weekly # Keep hooks up to date
skip: []
submodules: false