-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
289 lines (270 loc) · 8.06 KB
/
.pre-commit-config.yaml
File metadata and controls
289 lines (270 loc) · 8.06 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
---
exclude: |
(?x)^(
.*\{\{.*\}\}.*| # Exclude any files with cookiecutter variables
\.history/.*| # Exclude history files
.*cache.*/.*| # Exclude cache directories
.*venv.*/.*| # Exclude virtual environment directories
)$
fail_fast: false
default_language_version:
python: python3.12
default_install_hook_types:
- pre-commit
- commit-msg
repos:
# ---------------------
# General Hooks
# ---------------------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml
name: YAML · Syntax check
always_run: true
- id: end-of-file-fixer
name: Files · End-of-file fixer
always_run: true
- id: trailing-whitespace
name: Whitespace · Trim trailing
always_run: true
args: [--markdown-linebreak-ext=md]
- id: check-merge-conflict
name: Git · Merge conflict markers
always_run: true
- id: check-added-large-files
name: Git · Large file guard
always_run: true
exclude: (docs/img)
- id: check-ast
name: Python · Parse (AST)
always_run: true
- id: check-builtin-literals
name: Python · Builtin literals
always_run: true
- id: check-json
name: JSON · Syntax check
always_run: true
- id: check-toml
name: TOML · Syntax check
always_run: true
- id: check-xml
name: XML · Syntax check
always_run: true
- id: detect-private-key
name: Security · Detect private keys
always_run: true
- id: mixed-line-ending
name: Whitespace · Normalize line endings
always_run: true
- id: debug-statements
name: Python · Debug statements
always_run: true
- id: name-tests-test
name: Python · Test file naming
always_run: true
- id: destroyed-symlinks
name: Git · Destroyed symlinks
always_run: true
- id: check-docstring-first
name: Python · Docstring first
always_run: true
- id: check-case-conflict
name: Git · Case conflict
always_run: true
- id: double-quote-string-fixer
name: Python · Double quote fixer
always_run: true
- id: forbid-new-submodules
name: Git · Forbid new submodules
always_run: true
# ---------------------
# Commit Message Hooks
# ---------------------
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.13.9
hooks:
- id: commitizen
name: Git · Validate commit message
stages: [commit-msg]
always_run: true
additional_dependencies: [cz-conventional-gitmoji]
# ---------------------
# YAML Hooks
# ---------------------
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
name: YAML · Formatter
always_run: true
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '180']
exclude: (build/ansible/)
- repo: https://github.com/adrienverge/yamllint
rev: v1.38.0
hooks:
- id: yamllint
name: YAML · Linter
# ---------------------
# Shell Hooks
# ---------------------
- repo: http://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck
name: Shell · Shellcheck
files: \.sh$
- id: shfmt
name: Shell · Formatter
args: [-i, '4', -w]
- id: script-must-have-extension
name: Shell · Must have extension
- repo: https://github.com/openstack/bashate
rev: 2.1.1
hooks:
- id: bashate
name: Shell · Check shell script code style
files: \.sh$
# ---------------------
# Docker Hooks
# ---------------------
- repo: https://github.com/hadolint/hadolint
rev: v2.14.0
hooks:
- id: hadolint
name: Docker · Linter
# ---------------------
# Makefile Hooks
# ---------------------
- repo: https://github.com/mrtazz/checkmake.git
rev: v0.3.2
hooks:
- id: checkmake
name: Makefile · Lint Makefile
# ---------------------
# Python Hooks
# ---------------------
- repo: https://github.com/hhatto/autopep8
rev: v2.3.2
hooks:
- id: autopep8
name: Python · autopep8
- repo: https://github.com/PyCQA/isort
rev: 8.0.1
hooks:
- id: isort
name: Python · Import sorter
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.3
hooks:
- id: autoflake
name: Python · Remove unused imports
- repo: https://github.com/PyCQA/flake8
rev: 7.3.0
hooks:
- id: flake8
name: Python · Linter
args: [--ignore=E501]
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
- id: pyupgrade
name: Python · Upgrade syntax
always_run: true
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.25
hooks:
- id: validate-pyproject
name: Python · Validate pyproject.toml
always_run: true
additional_dependencies: ['validate-pyproject-schema-store[all]']
# ---------------------
# JSON Schema Hooks
# ---------------------
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.0
hooks:
- id: check-github-workflows
name: JSON Schema · GitHub workflows
- id: check-github-actions
name: JSON Schema · GitHub Actions
args: [--verbose]
- id: check-compose-spec
name: JSON Schema · Docker Compose files
- id: check-dependabot
name: JSON Schema · Dependabot Config (v2)
- id: check-renovate
name: JSON Schema · Renovate
# ---------------------
# Terraform / IaC Hooks
# ---------------------
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.30
hooks:
- id: terragrunt-hcl-fmt
name: Terraform/IaC · Terragrunt fmt
always_run: true
- id: tofu-fmt
name: Terraform/IaC · Tofu fmt
always_run: true
- id: tofu-validate
name: Terraform/IaC · Tofu validate
always_run: true
- id: packer-validate
name: Terraform/IaC · Packer validate
always_run: true
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.105.0
hooks:
- id: terraform_fmt
name: Terraform · Formatter
always_run: true
args: [--hook-config=--tf-path=tofu]
- id: terraform_tflint
name: Terraform · Linter
always_run: true
args: [--hook-config=--tf-path=tofu]
exclude: (modules/integrations/splunk_cloud_data_manager|modules/infra/forge_subscription|modules/integrations/splunk_secrets/|modules/integrations/splunk_cloud_s3_runner_logs/)
- id: terraform_validate
name: Terraform · Validate
always_run: true
args:
- --hook-config=--retry-once-with-cleanup=true
- --tf-init-args=-backend=false
- --tf-init-args=--upgrade=true
- --hook-config=--tf-path=tofu
- --hook-config=--parallelism-limit=1
exclude: (modules/integrations/splunk_cloud_data_manager|modules/integrations/splunk_cloud_s3_runner_logs)
# ---------------------
# Security Hooks
# ---------------------
- repo: https://github.com/gitleaks/gitleaks
rev: v8.30.0
hooks:
- id: gitleaks
name: Security · Gitleaks
always_run: true
# ---------------------
# Ansible Hooks
# ---------------------
- repo: https://github.com/ansible-community/ansible-lint.git
rev: v26.3.0
hooks:
- id: ansible-lint
name: Ansible · Linter
always_run: true
language_version: python3.12
# ---------------------
# Markdown Hooks
# ---------------------
- repo: https://github.com/hukkin/mdformat
rev: 1.0.0
hooks:
- id: mdformat
name: Markdown · Format markdown
additional_dependencies:
- mdformat-gfm
- mdformat-ruff
- mdformat-frontmatter
- ruff
exclude: (modules/)