-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
208 lines (188 loc) · 5.77 KB
/
.pre-commit-config.yaml
File metadata and controls
208 lines (188 loc) · 5.77 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
default_language_version:
python: python3
# Define common configuration variables
default_stages: [pre-commit]
repos:
# Standard pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0 # Updated version
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: check-executables-have-shebangs
- id: check-toml
- id: check-case-conflict
- id: check-added-large-files
- id: check-merge-conflict # Added: catches merge conflict markers
- id: check-json # Added: validate JSON files
# Python code formatting
- repo: https://github.com/psf/black
rev: 25.1.0 # Updated version
hooks:
- id: black
args: [--line-length, "299"]
# Python import sorting
- repo: https://github.com/PyCQA/isort
rev: 6.0.1
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]
# Python upgrading syntax to newer version
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1 # Updated version
hooks:
- id: pyupgrade
args: [--py38-plus]
# Python docstring formatting
- repo: https://github.com/myint/docformatter
rev: eb1df347edd128b30cd3368dddc3aa65edcfac38 # Don't autoupdate until https://github.com/PyCQA/docformatter/issues/293 is fixed
hooks:
- id: docformatter
args:
[
--in-place,
--wrap-summaries=99,
--wrap-descriptions=99,
--style=sphinx,
--black,
]
# Python docstring coverage checking
- repo: https://github.com/econchick/interrogate
rev: 1.7.0
hooks:
- id: interrogate
args:
[
--verbose,
--fail-under=100,
--ignore-init-module,
--ignore-init-method,
--ignore-module,
--ignore-nested-functions,
-vv,
]
exclude: "^tests/"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.5
hooks:
- id: ruff
args: ["--fix", "--line-length=299"]
# Type checking with mypy (fixed)
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.16.0
hooks:
- id: mypy
# Removed problematic types-all and added specific type stubs
additional_dependencies:
[
types-requests,
types-PyYAML,
types-toml,
types-setuptools,
types-tqdm,
types-seaborn,
]
exclude: "^tests/"
# Python security linter
- repo: https://github.com/PyCQA/bandit
rev: "1.8.3"
hooks:
- id: bandit
# Skip B101 (assert statements), B603/B607 (subprocess with trusted git commands)
args: ["-s", "B101,B603,B607"]
# yaml formatting
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8 # Updated version
hooks:
- id: prettier
types: [yaml]
exclude: "environment.yaml"
# shell scripts linter
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1 # Updated version
hooks:
- id: shellcheck
# md formatting
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.22 # Updated version
hooks:
- id: mdformat
args: ["--number"]
additional_dependencies:
- mdformat-gfm==0.3.7
- mdformat-tables
- mdformat_frontmatter
# word spelling linter
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1 # Updated version
hooks:
- id: codespell
args:
- --skip=logs/**,data/**,*.ipynb,*.bib
- --ignore-words-list=fro,ser,SER,Tung,ans,Wehn
# jupyter notebook cell output clearing
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
- id: nbstripout
# jupyter notebook linting
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.1 # Updated version
hooks:
- id: nbqa-black
args: ["--line-length=299"]
- id: nbqa-isort
args: ["--profile=black"]
- id: nbqa-ruff # Changed from flake8 to ruff
args: ["--line-length=299"]
# Documentation style checker
#- repo: https://github.com/pycqa/doc8
# rev: v1.1.1
# hooks:
# - id: doc8
# args: ["--ignore=D001"] # Ignore line length for documentation
# exclude: "docs/_build/|docs/generated/"
# Validate GitHub Actions workflows (new)
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.33.0
hooks:
- id: check-github-workflows
files: ^\.github/workflows/
# Check commit message format (new)
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.6.0
hooks:
- id: commitizen
stages: [commit-msg]
# Local hooks for project automation
- repo: local
hooks:
- id: install-requirements
name: Install requirements.txt
entry: pip install -r requirements.txt
language: system
always_run: true
pass_filenames: false
stages: [pre-commit]
- id: generate-changelog
name: Generate changelog.rst from CHANGELOG.md
entry: python scripts/generate_changelog.py
language: system
files: ^CHANGELOG\.md$
pass_filenames: false
- id: generate-api-reference
name: Generate API reference documentation
entry: python scripts/generate_api_reference.py docs/api_reference.rst
language: system
files: ^kaira/.*\.py$
pass_filenames: false
- id: generate-example-indices
name: Generate example gallery index files
entry: python scripts/generate_example_indices.py
language: system
files: ^examples/.*\.py$
pass_filenames: false