-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
214 lines (205 loc) · 6.67 KB
/
.pre-commit-config.yaml
File metadata and controls
214 lines (205 loc) · 6.67 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
exclude: ^node_modules/
repos:
- repo: meta
hooks:
- id: check-hooks-apply
name: check that hooks apply
description: check that all the hooks apply to the repository
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-illegal-windows-names
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-toml
- id: check-vcs-permalinks
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
exclude: ^atr/static/js/(ts|min)/|\.map$
- id: fix-byte-order-marker
- id: forbid-submodules
- id: mixed-line-ending
- id: trailing-whitespace
exclude: ^atr/static/js/(ts|min)/
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.6
hooks:
- id: insert-license
name: add a license for all Python files
files: ^(atr|scripts|tests)/(.*\.py$|.*\.pyi)$
args:
- --comment-style
- "|#|"
- --license-filepath
- scripts/ci/LICENSE-template.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: add a license for JS and TS files
files: ^atr/static/(js/src/.*\.js|ts/.*\.ts)$
args:
- --comment-style
- "/*| * |*/"
- --license-filepath
- scripts/ci/LICENSE-template.txt
- --fuzzy-match-generates-todo
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.48.0
hooks:
- id: markdownlint
name: run Markdown lints
description: check Markdown files with markdownlint
args: [--config=.github/linters/.markdown-lint.yml]
types: [markdown]
files: \.md$
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
- id: shellcheck
- repo: https://github.com/rtts/djhtml
rev: 3.0.11
hooks:
- id: djhtml
files: .*/.*\.html$
- id: djcss
files: .*/atr.css$
#- repo: https://github.com/Riverside-Healthcare/djLint
# rev: v1.36.4
# hooks:
# - id: djlint
# files: "atr/templates/.*\\.html$"
# types_or: ['html']
# args:
# - --profile=jinja
# - --lint
# - id: djlint
# name: Format HTML templates
# files: "atr/templates/.*\\.html$"
# types_or: ['html']
# args:
# - --profile=jinja
# - --reformat
- repo: https://github.com/thibaudcolas/pre-commit-stylelint
rev: v17.8.0
hooks:
- id: stylelint
additional_dependencies: ['stylelint@16.14.1', 'stylelint-config-standard@37.0.0']
files: "atr/static/css/.*\\.css$"
types_or: ['css']
args: ['--fix', '--allow-empty-input']
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.24.1
hooks:
- id: zizmor
args: [--min-severity, low]
- repo: https://github.com/pypa/pip-audit
rev: v2.10.0
hooks:
- id: pip-audit
args:
- '-r'
- 'pip-audit.requirements'
- '--disable-pip'
- '--no-deps'
- repo: https://github.com/oxc-project/mirrors-oxlint
rev: v1.60.0
hooks:
- id: oxlint
name: lint JS files with Oxlint
types: [javascript]
files: ^atr/static/js/src/.*\.js$
args:
# These must be in the order deny, warn, allow
- --deny=correctness
- --deny=perf
- --deny=suspicious
- --deny=pedantic
- --allow=unicorn/prefer-query-selector
# - repo: https://github.com/PyCQA/flake8
# rev: 7.3.0
# hooks:
# - id: flake8
# name: Flake8 (cognitive complexity and cohesion)
# additional_dependencies:
# - flake8-cognitive-complexity
# # - flake8-expression-complexity
# - flake8-cohesion
# args:
# - --max-line-length=120
# - --select=CCR001,H601
# # - --extend-ignore=E203,E251,E266,E402,F841
# - --max-cognitive-complexity=20
# # - --max-expression-complexity=7
# - --cohesion-below=50.0
- repo: local
hooks:
- id: ruff
name: lint Python files with Ruff
entry: uv run --frozen ruff check --fix
language: system
types: [python]
- id: ruff-format
name: format Python files with Ruff
entry: uv run --frozen ruff format --force-exclude
language: system
types: [python]
- id: biome-format
# Install biome from https://biomejs.dev/guides/manual-installation/
# Avoid using NPM to install it until #359 is resolved
name: format JS files with Biome
entry: biome format --write --files-ignore-unknown=true --no-errors-on-unmatched --colors=off
language: system
types: [javascript]
files: ^atr/static/js/src/.*\.js$
- id: biome-check
# Install biome from https://biomejs.dev/guides/manual-installation/
# Avoid using NPM to install it until #359 is resolved
name: lint JS files with Biome
entry: biome check --write --error-on-warnings --files-ignore-unknown=true --no-errors-on-unmatched --colors=off
language: system
types: [javascript]
files: ^atr/static/js/src/.*\.js$
- id: pyright
name: type check Python files with Pyright
entry: uv run --frozen pyright
language: system
require_serial: true
types: [python]
exclude: ^tests/
- id: jinja-route-check
name: check Jinja2 routes
description: Check whether routes used in Jinja2 templates actually exist
entry: uv run --frozen python scripts/lint/jinja_route_checker.py
language: system
pass_filenames: false
always_run: true
- id: check-when-dependencies-updated
name: check when dependencies were updated
description: Verify that dependencies were updated within the configured timeframe, for ASVS 15.2.1
entry: uv run --frozen python scripts/check_when_dependencies_updated.py
language: system
pass_filenames: false
always_run: true
- id: check-models-imports
name: check models imports
description: Ensure that the models only import from approved packages
entry: uv run --frozen python scripts/check_models_imports.py
language: system
pass_filenames: false
files: ^atr/models/.*\.py$
- id: check-nullable-fields
name: check SQL model nullability
description: Ensure non-optional SQLModel fields declare nullable=False
entry: uv run --frozen python scripts/check_nullable_fields.py
language: system
files: ^atr/models/sql\.py$
- id: template-usage-linter
name: check template usage
description: Ensure that all templates are used and available w/o duplicates
entry: uv run --frozen python scripts/check_templates.py atr
language: system
pass_filenames: false