-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy path.pre-commit-config.yaml
264 lines (264 loc) · 9.44 KB
/
.pre-commit-config.yaml
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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# If not configured otherwise, only run on commits
default_stages:
- commit
repos:
- repo: local
hooks:
- id: install-tools
name: "Install tools"
entry: "./scripts/precommit/install_tools.sh"
language: script
always_run: true
pass_filenames: false
description: "Install tools"
- id: proto
name: "Proto"
entry: "./scripts/precommit/generate_api.sh"
language: script
files: '\.proto$'
pass_filenames: false
description: "Protobuf generation"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude: ^(manifests/charts/.*/README*)|\.*svg$|\.*dot|api/gen/.*|sdks/aperture-java/lib/core/src/main/java/com/fluxninja/generated/.*$|\.github/.*|sdks/aperture-js/sdk/gen/.*|sdks/aperture-py/docs/.*
- id: end-of-file-fixer
exclude: ^(docs/|manifests/charts/.*/README*)|\.*svg$|\.*dot|api/gen/.*|sdks/aperture-java/lib/core/src/main/java/com/fluxninja/generated/.*$|blueprints/gen/jsonschema/.*|\.github/.*|sdks/aperture-js/sdk/gen/.*|sdks/aperture-py/docs/.*
- id: check-yaml
exclude: ^(manifests/charts/.*/(templates|files)/.*|playground/tanka/charts/.*|playground/scenarios/.*/charts/.*|\.github/.*)
args:
- "--allow-multiple-documents"
- id: check-added-large-files
exclude: ^(operator/config/crd/.*|docs/content/assets/.*)
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-json
- id: detect-private-key
# These certs are used for ValidatingWebhook, and used within a cluster,
# so it should be fine to have them in repo
exclude: ^certs/(ca.key|key.pem)$
- id: mixed-line-ending
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.20
hooks:
- id: shellcheck
exclude: ^(sdks/aperture-java/gradlew)$
- repo: https://github.com/fluxninja/pre-commit-hooks.git
rev: v0.0.4
hooks:
- id: circleci-validate
- repo: https://github.com/fluxninja/pre-commit-golang
rev: v1.0.0-fn
hooks:
- id: go-generate
- id: go-mod-tidy-repo
args:
- -compat=1.21
- repo: meta
hooks:
- id: check-hooks-apply
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.2
hooks:
- id: autoflake
args:
- --in-place
- --remove-unused-variables
- --remove-all-unused-imports
- --exclude
- "__init__.py"
exclude: &py_exclude "^sdks/aperture-py/aperture_sdk/_gen/"
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
args:
- --filter-files
- --profile
- black
exclude: *py_exclude
- repo: https://github.com/ambv/black
rev: 23.3.0
hooks:
- id: black
language_version: python3
exclude: *py_exclude
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.6"
hooks:
- id: prettier
additional_dependencies:
exclude: ^(docs/content/reference/.*|docs/content/reference/aperture-cli/aperturectl/.*|manifests/charts/.*/README*|.github|sdks/aperture-js/sdk/gen|sdks/aperture-js/docs/.*|sdks/aperture-py/docs/.*)
types_or:
[
sh,
shell,
bash,
zsh,
dockerfile,
makefile,
json,
java,
markdown,
jsonnet,
python3,
terraform,
mdx,
]
# local hooks
- repo: local
hooks:
- id: deprecated
name: Remove deprecated code
entry: ./scripts/check_deprecated.sh
language: script
pass_filenames: false
types_or:
- go
- proto
- id: golangci-lint
name: Run golangci-lint
entry: ./scripts/golangci_lint.sh
language: script
pass_filenames: false
require_serial: false
types:
- go
stages:
- commit
args:
- --fix
- id: java-spotless-lint
name: Run gradle spotless
description: "Run gradle spotless"
entry: ./scripts/precommit/java_spotless_lint.sh
language: script
pass_filenames: false
types:
- java
- id: generate-helm-readme
name: "Helm Readme"
entry: "./scripts/precommit/generate_helm_readme.sh"
language: script
files: "^manifests/charts/.*"
pass_filenames: false
description: "Generate helm readme"
- id: helmlint
name: "Helm Lint"
description: Run helm lint, a linter for helm charts
files: "^manifests/charts/.*"
pass_filenames: false
entry: ./scripts/precommit/helmlint.sh
language: script
- id: generate-swagger
name: "Config Swagger"
entry: "./scripts/precommit/generate_swagger.sh"
language: script
files: '\.proto$|\.go$'
pass_filenames: false
description: "Generate swagger"
- id: generate-config-markdown
name: "Config Markdown"
entry: "./scripts/precommit/generate_config_markdown.sh"
language: script
files: '\.proto$|\.go$'
pass_filenames: false
description: "Generate config markdown"
- id: generate-aperturectl-docs
name: "Config aperturectl docs"
entry: "./scripts/precommit/generate_aperturectl_docs.sh"
language: script
files: "^cmd/aperturectl/.*"
pass_filenames: false
description: "Generate CLI docs"
- id: generate-aperturejs-docs
name: "Generate aperture-js docs"
entry: "./scripts/precommit/generate_aperturejs_docs.sh"
language: script
files: "^sdks/aperture-js/sdk/.*|^sdks/aperture-js/proto/.*"
pass_filenames: false
description: "Generate aperturejs docs"
- id: generate-aperturepy-docs
name: "Generate aperture-py docs"
entry: "./scripts/precommit/generate_aperturepy_docs.sh"
language: script
files: "^sdks/aperture-py/.*"
pass_filenames: false
description: "Generate aperture-py docs"
- id: generate-blueprints
name: "Generate Blueprints"
entry: "./scripts/precommit/generate_blueprints.sh"
language: script
files: ^(blueprints|docs/content/reference/blueprints)|\.proto$|^requirements.txt$
pass_filenames: false
description: "Generate Aperture libsonnet and blueprints"
- id: generate-playground-policies
name: "Generate Playground Policies"
entry: "./scripts/precommit/generate_playground_policies.sh"
language: script
files: ^(blueprints|playground/scenarios/)|\.proto$|^requirements.txt$
pass_filenames: false
description: "Generate Aperture libsonnet and blueprints"
- id: generate-otel-docs
name: "OpenTelemetry Docs"
language: script
entry: ./scripts/precommit/generate_otel_docs.sh
pass_filenames: false
files: ^(extensions/integrations/otel|docs/tools/otel_collectors)
description: "Generate OpenTelemetry docs"
- id: generate-doc-assets
name: "Documentation Assets"
entry: "./scripts/precommit/generate_doc_assets.sh"
language: script
files: ^(blueprints|docs)
pass_filenames: false
description: "Generate documentation assets"
- id: tanka-show
name: "Check tanka parses jsonnet"
language: script
entry: ./scripts/precommit/check_tanka_show.sh
pass_filenames: false
files: ^(playground/tanka/|blueprints)
types_or:
- jsonnet
- json
- yaml
- id: tanka-fmt
name: "Tanka fmt"
exclude: ^(playground/tanka/lib/apps/aperture-grafana/.*)
language: system
entry: tk
args:
- fmt
types:
- jsonnet
- id: check-operator-spec-changes
name: "Check Operator Spec Changes"
description: Checking if the Operator spec is changed
entry: ./scripts/precommit/check-operator-spec.sh
language: script
pass_filenames: false
- id: check-extensions-md5sum
name: "Check accidental changes to extensions.go"
entry: ./scripts/precommit/check-extensions-go.sh
description: Check if extensions.go has changed
language: script
pass_filenames: false
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args:
- "-L inport,atleast,iteraction"
- "--ignore-words=./.github/styles/config/vocabularies/FluxNinja/accept.txt"
exclude: ^(.*\.svg|yarn.lock|go.sum|.*/go.sum|.circleci/.*|docs/content/reference/api/.*|api/gen/.*|sdks/aperture-java/lib/core/src/main/java/com/fluxninja/generated/.*|sdks/aperture-py/aperture_sdk/_gen/.*|blueprints/gen/.*|sdks/aperture-js/docs/.*|sdks/aperture-js/README.md|sdks/aperture-py/docs/.*|playground/resources/nginx/.*|\.github/.*|.*\.libsonnet|playground/resources/demo-ui/package-lock\.json|sdks/aperture-js/example/package-lock.json)$
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.12.1
hooks:
- id: markdownlint-cli2
files: '^docs/content/.*\.md$'