-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
170 lines (154 loc) · 4.94 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
170 lines (154 loc) · 4.94 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
# Pre-commit configuration for mongodb-kubernetes
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_stages: [pre-commit]
# Hooks run serially in definition order. The following local hooks have
# dependencies and must run in this order:
# 1. update-mongodb-operator-version: writes release.json:mongodbOperator
# 2. update-release-json: propagates mongodbOperator, writes release.json
# 3. update-values-yaml: reads release.json, writes helm values files
# 4. generate-standalone-yaml: reads helm values files
# 5. generate-and-update: remaining parallel jobs
repos:
- repo: local
hooks:
- id: update-mongodb-operator-version
name: update-mongodb-operator-version
entry: scripts/dev/generate_files.sh update_operator_version
language: system
pass_filenames: false
stages: [pre-commit]
- id: update-release-json
name: update-release-json
entry: scripts/dev/generate_files.sh update_release
language: system
pass_filenames: false
stages: [pre-commit]
- id: update-values-yaml
name: update-values-yaml
entry: scripts/dev/generate_files.sh update_values
language: system
pass_filenames: false
stages: [pre-commit]
- id: generate-standalone-yaml
name: generate-standalone-yaml
entry: scripts/dev/generate_files.sh generate_standalone_yaml
language: system
pass_filenames: false
stages: [pre-commit]
# Remaining generation jobs run in parallel
- id: generate-and-update
name: generate-and-update (parallel)
entry: scripts/dev/generate_files.sh generate_all
language: system
pass_filenames: false
stages: [pre-commit]
- repo: local
hooks:
- id: validate-snippets
name: validate-snippets
entry: scripts/code_snippets/validate_snippets.py
language: system
pass_filenames: false
stages: [pre-commit]
- repo: local
hooks:
- id: validate-helm-charts
name: validate-helm-charts
entry: scripts/dev/lint_helm_chart.sh
language: system
pass_filenames: false
stages: [pre-commit]
- repo: local
hooks:
- id: validate-go-version
name: validate-go-version
entry: scripts/dev/update_go_version.sh
language: system
pass_filenames: false
stages: [pre-commit]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# TODO: Enable these hooks in a follow-up PR - they modify 200+ files
# - id: trailing-whitespace
# exclude: |
# (?x)^(
# .*\.patch$|
# vendor/.*|
# testdata/.*|
# helm_chart/crds/.*|
# public/crds\.yaml$|
# config/crd/bases/.*
# )
# - id: end-of-file-fixer
# exclude: |
# (?x)^(
# .*\.patch$|
# vendor/.*|
# testdata/.*|
# helm_chart/crds/.*|
# public/crds\.yaml$|
# config/crd/bases/.*
# )
- id: check-added-large-files
- id: check-merge-conflict
- id: check-json
exclude: |
(?x)^(
vendor/.*|
testdata/.*
)
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.10.0
hooks:
- id: shellcheck
exclude: |
(?x)^(
vendor/.*|
scripts/dev/contexts/private-context.*
)
files: |
(?x)(
\.sh$|
^scripts/dev/contexts/[^/]+$|
^scripts/funcs/[^/]+$
)
- repo: local
hooks:
- id: ty
name: ty
entry: bash -c 'cd docker/mongodb-kubernetes-tests && uvx ty check tests/'
language: system
pass_filenames: false
files: docker/mongodb-kubernetes-tests/tests/.*\.py$
stages: [pre-commit]
- repo: local
hooks:
- id: govulncheck
name: govulncheck
entry: go run golang.org/x/vuln/cmd/govulncheck@latest ./...
language: system
pass_filenames: false
files: (\.go$|^go\.(mod|sum)$)
stages: [pre-commit]
- repo: https://github.com/golangci/golangci-lint
rev: v2.1.0
hooks:
# golangci-lint-full (not golangci-lint) runs on the entire module rather than only
# files changed since HEAD, so linters that need whole-program analysis (e.g. unused,
# staticcheck) see the full codebase and pre-existing violations are not silently skipped.
- id: golangci-lint-full
args: [--timeout=10m]
language_version: 1.26.4
- id: golangci-lint-fmt
language_version: 1.26.4