forked from vmware-tanzu/vm-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
233 lines (219 loc) · 7.37 KB
/
.golangci.yml
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
run:
timeout: 5m
# override defaults
linters-settings:
# gocyclo:
# min-complexity: 18
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/vmware-tanzu
importas:
alias:
- alias: context
pkg: context
- alias: corev1
pkg: k8s.io/api/core/v1
- alias: metav1
pkg: k8s.io/apimachinery/pkg/apis/meta/v1
- alias: apiconversion
pkg: k8s.io/apimachinery/pkg/conversion
- alias: apierrors
pkg: k8s.io/apimachinery/pkg/api/errors
- alias: apierrorsutil
pkg: k8s.io/apimachinery/pkg/util/errors
- alias: ctrl
pkg: sigs.k8s.io/controller-runtime
- alias: ctrlcache
pkg: sigs.k8s.io/controller-runtime/pkg/cache
- alias: ctrlconversion
pkg: sigs.k8s.io/controller-runtime/pkg/conversion
- alias: ctrlclient
pkg: sigs.k8s.io/controller-runtime/pkg/client
- alias: ctrlmgr
pkg: sigs.k8s.io/controller-runtime/pkg/manager
- alias: vim25
pkg: github.com/vmware/govmomi/vim25
- alias: mo
pkg: github.com/vmware/govmomi/vim25/mo
- alias: vimtypes
pkg: github.com/vmware/govmomi/vim25/types
- alias: backupapi
pkg: github.com/vmware-tanzu/vm-operator/pkg/backup/api
- alias: vmopv1a1
pkg: github.com/vmware-tanzu/vm-operator/api/v1alpha1
- alias: vmopv1a2
pkg: github.com/vmware-tanzu/vm-operator/api/v1alpha2
- alias: vmopv1a2cloudinit
pkg: github.com/vmware-tanzu/vm-operator/api/v1alpha2/cloudinit
- alias: vmopv1a2common
pkg: github.com/vmware-tanzu/vm-operator/api/v1alpha2/common
- alias: vmopv1a2sysprep
pkg: github.com/vmware-tanzu/vm-operator/api/v1alpha2/sysprep
- alias: vmopv1
pkg: github.com/vmware-tanzu/vm-operator/api/v1alpha3
- alias: vmopv1cloudinit
pkg: github.com/vmware-tanzu/vm-operator/api/v1alpha3/cloudinit
- alias: vmopv1common
pkg: github.com/vmware-tanzu/vm-operator/api/v1alpha3/common
- alias: vmopv1sysprep
pkg: github.com/vmware-tanzu/vm-operator/api/v1alpha3/sysprep
- alias: vmopv1util
pkg: github.com/vmware-tanzu/vm-operator/pkg/util/vmopv1
- alias: byokv1
pkg: github.com/vmware-tanzu/vm-operator/external/byok/api/v1alpha1
- alias: capv1
pkg: github.com/vmware-tanzu/vm-operator/external/capabilities/api/v1alpha1
- alias: pkgcfg
pkg: github.com/vmware-tanzu/vm-operator/pkg/config
- alias: pkgctx
pkg: github.com/vmware-tanzu/vm-operator/pkg/context
- alias: ctxop
pkg: github.com/vmware-tanzu/vm-operator/pkg/context/operation
- alias: pkgmgr
pkg: github.com/vmware-tanzu/vm-operator/pkg/manager
- alias: pkgutil
pkg: github.com/vmware-tanzu/vm-operator/pkg/util
- alias: proberctx
pkg: github.com/vmware-tanzu/vm-operator/pkg/prober/context
depguard:
rules:
main:
list-mode: lax # allow unless explicitly denied
files:
- $all
- "!$test"
- "!**/test/builder/*.go"
- "!**/matcher.go"
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: github.com/pkg/errors
desc: "replaced by stdlib errors package since Go.13: https://go.dev/blog/go1.13-errors"
- pkg: k8s.io/utils
desc: "replaced by internal packages like pkg/util/ptr"
- pkg: testing
desc: "do not import testing packages in non-test sources"
- pkg: github.com/onsi/ginkgo$
desc: "do not import testing packages in non-test sources"
- pkg: github.com/onsi/ginkgo/v2
desc: "do not import testing packages in non-test sources"
- pkg: github.com/onsi/gomega
desc: "do not import testing packages in non-test sources"
test:
list-mode: lax # allow unless explicitly denied
files:
- $test
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: github.com/pkg/errors
desc: "replaced by stdlib errors package since Go.13: https://go.dev/blog/go1.13-errors"
- pkg: k8s.io/utils
desc: "replaced by internal packages like pkg/util/ptr"
- pkg: github.com/onsi/ginkgo$
desc: "replaced by github.com/onsi/ginkgo/v2"
test-builder:
list-mode: lax # allow unless explicitly denied
files:
- "**/test/builder/*.go"
- "**/matcher.go"
- "!$test"
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: github.com/pkg/errors
desc: "replaced by stdlib errors package since Go.13: https://go.dev/blog/go1.13-errors"
- pkg: k8s.io/utils
desc: "replaced by internal packages like pkg/util/ptr"
- pkg: github.com/onsi/ginkgo$
desc: "replaced by github.com/onsi/ginkgo/v2"
linters:
disable-all: true
enable:
- asciicheck
- bodyclose
- depguard
- dogsled
- errcheck
- exportloopref
- goconst
- gocritic
- gocyclo
- godot
- gofmt
- goimports
- goprintffuncname
- gosec
- gosimple
- govet
- importas
- ineffassign
- misspell
- nakedret
- nilerr
- nolintlint
- prealloc
- revive
- rowserrcheck
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
issues:
max-same-issues: 0
max-issues-per-linter: 0
# Disable the default golangci exclusions so no issues are skipped. This helps
# reviewers focus on reviewing the most relevant changes in the PRs and avoid
# nitpicking.
exclude-use-default: false
exclude-dirs:
- external
- pkg/util/cloudinit/schema
exclude-files:
- ".*generated.*\\.go"
exclude:
# TODO: Remove the following exclusions over time once we have fixed those.
- "ST1000: at least one file in a package should have a package comment"
# List of regexps of issue texts to exclude, empty list by default.
exclude-rules:
- linters:
- staticcheck
text: "^SA1019: [^.]+.Wait is deprecated: Please use WaitEx instead."
- linters:
- staticcheck
text: "^SA1019: [^.]+.WaitForResult is deprecated: Please use WaitForResultEx instead."
- linters:
- revive
text: ".*should have (a package )?comment.*"
- linters:
- revive
text: "^exported: comment on exported const"
- linters:
- staticcheck
text: "^SA1019: .*TCPSocket is deprecated"
- linters:
- govet
text: "printf: non-constant format string in call"
# Dot imports for gomega or ginkgo are allowed within test files.
- path: test/builder/intg_test_context.go
text: should not use dot imports
- path: test/builder/test_suite.go
text: should not use dot imports
- path: test/builder/vcsim_test_context.go
text: should not use dot imports
- path: _test.go
text: should not use dot imports
# All of our webhooks follow the pattern of passing the webhook context which
# contains fields like the Client. Ignore the linter warnings for now.
- path: webhooks/
text: ".* `ctx` is unused"
- path: _test.go
linters:
- gosec
- depguard
- linters:
- revive
text: "unused-parameter: parameter"