forked from gardener/gardener
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yaml
261 lines (256 loc) · 11.2 KB
/
.golangci.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
run:
concurrency: 4
deadline: 10m
skip-dirs:
- pkg/client/core
- pkg/client/extensions
- pkg/client/seedmanagement
- pkg/client/settings
skip-files:
- ".*\\.pb\\.go$"
- "zz_generated\\..*\\.go$"
- "openapi_generated\\.go$"
linters:
enable:
- revive
- unused
- importas
- logcheck
- ginkgolinter
- exportloopref
- nilerr
- whitespace
issues:
exclude-use-default: false
exclude:
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
# revive:
- var-naming # ((var|const|struct field|func) .* should be .*
- dot-imports # should not use dot imports
- package-comments # package comment should be of the form
- unexported-return # exported func .* returns unexported type .*, which can be annoying to use
- indent-error-flow # if block ends with a return statement, so drop this else and outdent its block
- "exported: (type|func) name will be used as .* by other packages, and that stutters;"
# typecheck:
- "undeclared name: `.*`"
- "\".*\" imported but not used"
# allow non-capitalized messages if they start with technical terms
- "structured logging message should be capitalized: \"garden(er-apiserver|er-controller-manager|er-admission-controller|er-operator|er-resource-manager|let)"
exclude-rules:
- linters:
- staticcheck
text: "SA1019:" # Excludes messages where deprecated variables are used
linters-settings:
loggercheck:
require-string-key: true
no-printf-like: true
revive:
rules:
- name: duplicated-imports
- name: unused-parameter
- name: unreachable-code
- name: context-as-argument
- name: early-return
- name: exported
importas:
alias:
# External imported packages
- pkg: k8s.io/api/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: k8s.io/apimachinery/pkg/api/([^m]\w+)
alias: api${1}
- pkg: k8s.io/apimachinery/pkg/api/meta/table
alias: metatable
- pkg: k8s.io/apimachinery/pkg/util/(\w+)
alias: util${1}
- pkg: k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1
alias: vpaautoscalingv1
- pkg: k8s.io/kube-aggregator/pkg/apis/apiregistration/v1
alias: apiregistrationv1
- pkg: k8s.io/client-go/informers
alias: kubeinformers
- pkg: k8s.io/client-go/kubernetes
alias: kubernetesclientset
- pkg: k8s.io/client-go/tools/clientcmd/api/(\w+)
alias: clientcmd${1}
- pkg: k8s.io/client-go/tools/cache
alias: toolscache
- pkg: k8s.io/kubelet/config/v1beta1
alias: kubeletconfigv1beta1
- pkg: k8s.io/utils/clock/testing
alias: testclock
- pkg: k8s.io/apiserver/pkg/endpoints/openapi
alias: openapinamer
- pkg: k8s.io/apiserver/pkg/server
alias: genericapiserver
- pkg: k8s.io/apiserver/pkg/server/options
alias: genericoptions
- pkg: k8s.io/apiserver/pkg/server/storage
alias: serverstorage
- pkg: k8s.io/apiserver/pkg/util/feature
alias: utilfeature
- pkg: k8s.io/component-base/config
alias: componentbaseconfig
- pkg: k8s.io/component-base/logs/api/v1
alias: logsv1
- pkg: sigs.k8s.io/controller-runtime/pkg/client/fake
alias: fakeclient
- pkg: sigs.k8s.io/controller-runtime/pkg/log/zap
alias: logzap
- pkg: sigs.k8s.io/controller-runtime/pkg/log
alias: logf
- pkg: go.uber.org/mock/gomock
alias: gmock
- pkg: github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2
alias: fluentbitv1alpha2
- pkg: github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins/filter
alias: fluentbitv1alpha2filter
- pkg: github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins/parser
alias: fluentbitv1alpha2parser
- pkg: github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins/input
alias: fluentbitv1alpha2input
# Gradener external imported packages
- pkg: github.com/gardener/hvpa-controller/api/v1alpha1
alias: hvpav1alpha1
- pkg: github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1
alias: machinev1alpha1
- pkg: github.com/gardener/etcd-druid/api/v1alpha1
alias: druidv1alpha1
# Gardener extension package
- pkg: github.com/gardener/gardener/extensions/.*/(\w+)/mock$
alias: extensionsmock${1}
- pkg: github.com/gardener/gardener/extensions/pkg/apis/config
alias: extensionsconfig
- pkg: github.com/gardener/gardener/extensions/pkg/controller
alias: extensionscontroller
- pkg: github.com/gardener/gardener/extensions/pkg/predicate
alias: extensionspredicate
- pkg: github.com/gardener/gardener/extensions/pkg/controller/([^m]\w+)
alias: extensions${1}controller
- pkg: github.com/gardener/gardener/extensions/pkg/controller/heartbeat/cmd
alias: extensionsheartbeatcmd
- pkg: github.com/gardener/gardener/extensions/pkg/controller/worker/helper
alias: extensionsworkerhelper
- pkg: github.com/gardener/gardener/extensions/pkg/util/secret/manager
alias: extensionssecretsmanager
- pkg: github.com/gardener/gardener/extensions/pkg/webhook
alias: extensionswebhook
- pkg: github.com/gardener/gardener/extensions/pkg/webhook/([^m]\w+)
alias: extensions${1}webhook
# Gardener other packages
- pkg: github.com/gardener/gardener/pkg/api/extensions
alias: apiextensions
- pkg: github.com/gardener/gardener/pkg/apis/core
alias: gardencore
- pkg: github.com/gardener/gardener/pkg/apis/core/([\w\d]+)
alias: gardencore${1}
- pkg: github.com/gardener/gardener/pkg/apis/core/([\w\d]+)/helper
alias: ${1}helper
- pkg: github.com/gardener/gardener/pkg/apis/([^c]\w+)/([\w\d]+)
alias: $1$2
- pkg: github.com/gardener/gardener/pkg/apis/([^c]\w+)/([\w\d]+)/([\w\d]+)
alias: $1$2$3
- pkg: github.com/gardener/gardener/pkg/(\w+)/apis/config
alias: ${1}config
- pkg: github.com/gardener/gardener/pkg/(\w+)/apis/config/([\w\d]+)
alias: $1$2
- pkg: github.com/gardener/gardener/pkg/(\w+)/features
alias: ${1}features
- pkg: github.com/gardener/gardener/pkg/\w+/controller/([\w\d]+)
alias: ${1}controller
- pkg: github.com/gardener/gardener/pkg/\w+/webhook/([\w\d]+)
alias: ${1}webhook
- pkg: github.com/gardener/gardener/pkg/apiserver/admission/initializer
alias: admissioninitializer
- pkg: github.com/gardener/gardener/pkg/chartrenderer
alias: chartrenderer
- pkg: github.com/gardener/gardener/pkg/client/core/clientset/internalversion
alias: gardencoreclientset
- pkg: github.com/gardener/gardener/pkg/client/core/clientset/versioned
alias: gardencoreversionedclientset
- pkg: github.com/gardener/gardener/pkg/client/core/informers/externalversions
alias: gardencoreexternalinformers
- pkg: github.com/gardener/gardener/pkg/client/core/informers/internalversion
alias: gardencoreinformers
- pkg: github.com/gardener/gardener/pkg/client/core/listers/core/internalversion
alias: gardencorelisters
- pkg: github.com/gardener/gardener/pkg/client/kubernetes
alias: kubernetesclient
- pkg: github.com/gardener/gardener/pkg/client/kubernetes/(\w+)
alias: kubernetes${1}
- pkg: github.com/gardener/gardener/pkg/client/kubernetes/clientmap/builder
alias: clientmapbuilder
- pkg: github.com/gardener/gardener/pkg/client/kubernetes/clientmap/fake
alias: fakeclientmap
- pkg: github.com/gardener/gardener/pkg/client/seedmanagement/clientset/versioned
alias: seedmanagementclientset
- pkg: github.com/gardener/gardener/pkg/client/seedmanagement/informers/externalversions
alias: seedmanagementinformers
- pkg: github.com/gardener/gardener/pkg/client/seedmanagement/clientset/versioned/fake
alias: fakeseedmanagement
- pkg: github.com/gardener/gardener/pkg/client/settings/clientset/versioned
alias: settingsclientset
- pkg: github.com/gardener/gardener/pkg/client/settings/informers/externalversions
alias: settingsinformers
- pkg: github.com/gardener/gardener/pkg/client/settings/listers/settings/v1alpha1
alias: settingsv1alpha1lister
- pkg: github.com/gardener/gardener/pkg/controllerutils/(\w+)
alias: ${1}utils
- pkg: github.com/gardener/gardener/pkg/envtest
alias: gardenerenvtest
- pkg: github.com/gardener/gardener/pkg/extensions
alias: gardenerextensions
- pkg: github.com/gardener/gardener/pkg/gardenlet/bootstrap/util
alias: gardenletbootstraputil
- pkg: github.com/gardener/gardener/pkg/healthz
alias: gardenerhealthz
- pkg: github.com/gardener/gardener/pkg/mock/apiserver/authorization/authorizer
alias: mockauthorizer
- pkg: github.com/gardener/gardener/pkg/mock/\w+/(\w+)
alias: mock${1}
- pkg: github.com/gardener/gardener/pkg/mock/client-go/core/v1
alias: mockcorev1
- pkg: github.com/gardener/gardener/pkg/mock/client-go/tools/(\w+)
alias: mock${1}
- pkg: github.com/gardener/gardener/pkg/mock/client-go/util/(\w+)
alias: mock${1}
- pkg: github.com/gardener/gardener/pkg/operation/.*/(\w+)/mock$
alias: mock${1}
- pkg: github.com/gardener/gardener/pkg/component/(\w+)/constants
alias: ${1}constants
- pkg: github.com/gardener/gardener/pkg/operation/(\w+)
alias: ${1}pkg
- pkg: github.com/gardener/gardener/pkg/operator/client
alias: operatorclient
- pkg: github.com/gardener/gardener/pkg/registry/(\w+)/rest
alias: ${1}rest
- pkg: github.com/gardener/gardener/pkg/registry/\w+/([^r]\w+)
alias: ${1}registry
- pkg: github.com/gardener/gardener/pkg/registry/\w+/(\w+)/storage$
alias: ${1}store
- pkg: github.com/gardener/gardener/pkg/resourcemanager/client
alias: resourcemanagerclient
- pkg: github.com/gardener/gardener/pkg/resourcemanager/predicate
alias: resourcemanagerpredicate
- pkg: github.com/gardener/gardener/pkg/utils/(\w+)
alias: ${1}utils
- pkg: github.com/gardener/gardener/pkg/utils/secrets/manager
alias: secretsmanager
- pkg: github.com/gardener/gardener/pkg/utils/secrets/manager/fake
alias: fakesecretsmanager
- pkg: github.com/gardener/gardener/pkg/utils/validation/kubernetes/(\w+)
alias: kubernetes${1}validation
- pkg: github.com/gardener/gardener/plugin/pkg/utils
alias: admissionutils
- pkg: github.com/gardener/gardener/plugin/pkg/shoot/dnsrewriting
alias: shootdnsrewriting
- pkg: github.com/gardener/gardener/plugin/pkg/shoot/oidc
alias: applier
custom:
logcheck:
path: hack/tools/bin/logcheck.so
description: Check structured logging calls to logr.Logger instances
original-url: github.com/gardener/gardener/hack/tools/logcheck