generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 23
/
.golangci.yaml
249 lines (236 loc) · 8.43 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
run:
modules-download-mode: readonly
timeout: 10m
build-tags:
- e2e
linters:
enable-all: true
disable:
# Depreacted linters
- gomnd
- execinquery
- exportloopref
# Linters to be enabled after fixing the issues
- cyclop
- depguard
- exhaustruct
- forcetypeassert
- funlen
- gochecknoglobals
- goconst
- godot
- godox
- err113
- gofumpt
- ireturn
- lll
- maintidx
- mirror
- nestif
- nonamedreturns
- paralleltest
- perfsprint
- prealloc
- protogetter
- tagliatelle
- testifylint
- testpackage
- thelper
- tparallel
- varnamelen
- wrapcheck
- nlreturn
linters-settings:
dupl:
threshold: 100 # Tokens count to trigger error.
importas:
no-unaliased: true
no-extra-aliases: true
alias:
- pkg: crypto/rand
alias: crand
- pkg: github.com/kyma-project/telemetry-manager/apis/operator/v1alpha1
alias: operatorv1alpha1
- pkg: github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1
alias: telemetryv1alpha1
- pkg: github.com/kyma-project/telemetry-manager/apis/telemetry/v1beta1
alias: telemetryv1beta1
- pkg: github.com/kyma-project/telemetry-manager/controllers/telemetry
alias: telemetrycontrollers
- pkg: github.com/kyma-project/telemetry-manager/internal/selfmonitor/webhook
alias: selfmonitorwebhook
- pkg: github.com/kyma-project/telemetry-manager/internal/resources/common
alias: commonresources
- pkg: github.com/kyma-project/telemetry-manager/test/testkit/k8s
alias: kitk8s
- pkg: github.com/kyma-project/telemetry-manager/test/testkit/kyma
alias: kitkyma
- pkg: github.com/kyma-project/telemetry-manager/webhook/logparser
alias: logparserwebhook
- pkg: github.com/kyma-project/telemetry-manager/webhook/logpipeline
alias: logpipelinewebhook
- pkg: github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline/fluentbit
alias: logpipelinefluentbit
- pkg: github.com/prometheus/client_golang/api/prometheus/v1
alias: promv1
- pkg: github.com/prometheus/client_model/go
alias: prommodel
- pkg: go.opentelemetry.io/otel/sdk/trace
alias: tracesdk
- pkg: istio.io/api/networking/v1
alias: istionetworkingv1
- pkg: istio.io/client-go/pkg/apis/networking/v1
alias: istionetworkingclientv1
- pkg: istio.io/api/security/v1
alias: istiosecurityv1
- pkg: istio.io/client-go/pkg/apis/security/v1
alias: istiosecurityclientv1
- pkg: istio.io/api/type/v1beta1
alias: istiotypev1beta1
- pkg: k8s.io/api/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
alias: apiextensionsv1
- pkg: k8s.io/apimachinery/pkg/api/equality
alias: apiequality
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: k8s.io/apimachinery/pkg/util/runtime
alias: utilruntime
- pkg: k8s.io/client-go/kubernetes/scheme
alias: clientgoscheme
- pkg: sigs.k8s.io/controller-runtime
alias: ctrl
- pkg: sigs.k8s.io/controller-runtime/pkg/builder
alias: ctrlbuilder
- pkg: sigs.k8s.io/controller-runtime/pkg/log
alias: logf
- pkg: sigs.k8s.io/controller-runtime/pkg/log/zap
alias: logzap
- pkg: sigs.k8s.io/controller-runtime/pkg/metrics/server
alias: metricsserver
- pkg: sigs.k8s.io/controller-runtime/pkg/predicate
alias: ctrlpredicate
- pkg: github.com/kyma-project/telemetry-manager/internal/reconciler/commonstatus/stubs
alias: commonStatusStubs
- pkg: k8s.io/client-go/testing
alias: clienttesting
# Utils aliases
- pkg: github.com/kyma-project/telemetry-manager/internal/utils/k8s
alias: k8sutils
- pkg: github.com/kyma-project/telemetry-manager/internal/utils/logger
alias: loggerutils
- pkg: github.com/kyma-project/telemetry-manager/internal/utils/logpipeline
alias: logpipelineutils
- pkg: github.com/kyma-project/telemetry-manager/internal/utils/predicate
alias: predicateutils
- pkg: github.com/kyma-project/telemetry-manager/internal/utils/sharedtypes
alias: sharedtypesutils
- pkg: github.com/kyma-project/telemetry-manager/internal/utils/slices
alias: slicesutils
- pkg: github.com/kyma-project/telemetry-manager/internal/utils/test
alias: testutils
errcheck:
check-type-assertions: true # Reports type assertions: `a := b.(SomeStruct)`.
check-blank: true # Report assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`.
exclude-functions: # List of functions to exclude from checking.
- io/ioutil.ReadFile
- io.Copy(*bytes.Buffer)
- io.Copy(os.Stdout)
- gopkg.in/yaml.v3.Marshal
errchkjson:
check-error-free-encoding: true
report-no-exported: true
gci:
sections:
- standard # Standard packages.
- default # Imports that could not be matched to another section type.
- prefix(github.com/kyma-project/telemetry-manager) # Imports with the specified Prefix.
- blank # Blank imports
custom-order: true
goimports:
local-prefixes: github.com/kyma-project/telemetry-manager
govet:
enable:
- shadow
loggercheck:
klog: true # Allows checking for the k8s.io/klog/v2.
zap: true # Allows checking for the go.uber.org/zap.
kitlog: false # Prohibits checking for the github.com/go-kit/log.
logr: false # Prohibits checking for the github.com/go-logr/logr.
require-string-key: true # Require all logging keys to be inlined constant strings.
no-printf-like: true
misspell:
locale: US
stylecheck:
dot-import-whitelist:
# Allows using dot imports for Ginkgo and Gomega (out-of-the-box and custom matchers)
- github.com/onsi/ginkgo/v2
- github.com/onsi/gomega
- github.com/kyma-project/telemetry-manager/test/testkit/matchers/log
- github.com/kyma-project/telemetry-manager/test/testkit/matchers/metric
- github.com/kyma-project/telemetry-manager/test/testkit/matchers/trace
- github.com/kyma-project/telemetry-manager/test/testkit/matchers/prometheus
nolintlint:
allow-unused: true
require-explanation: true
require-specific: true
revive:
rules:
- name: dot-imports
disabled: true
- name: unexported-return
gocyclo:
# Minimal code complexity to report.
# Default: 30
# The max complexity while enabling this linter is 17. Please check if this can be reduced. Increase the threshold only if it is absolutely necessary.
min-complexity: 17
wsl:
allow-trailing-comment: true
issues:
exclude:
# Check this issue for more info: https://github.com/kyoh86/scopelint/issues/4
- Using the variable on range scope `tc` in function literal
- Using the variable on range scope `tt` in function literal
exclude-rules:
- path: _test\.go
linters:
- errcheck
- dupl
- err113
- path: ^internal/utils/test
linters:
- mnd
- err113
- path: ^test/testkit
linters:
- mnd
- err113
- path: _test\.go
text: "shadow: declaration of \"ctx\" shadows declaration at line ([\\d]+)"
linters:
- govet
- path: .go
text: "shadow: declaration of \"err\" shadows declaration at line ([\\d]+)"
linters:
- govet
- linters: [dupl]
path: controllers/telemetry/(logparser|logpipeline|metricpipeline|tracepipeline)_controller.go
- linters: [dupl]
path: internal/utils/k8s/utils.go
# Unify components checkers after getting rid of custom conditions in favor of metav1.Conditions
- linters: [dupl]
path: internal/reconciler/telemetry/(log|metric|trace)_components_checker.go
- linters: [dupl]
path: test/testkit/matchers/(log|metric|trace)_matchers.go
- linters: [errcheck]
path: test/testkit/otel/traces/traces.go
- linters: [dupl]
path: test/testkit/assert/(deployment|daemon_set|metrics|traces|stateful_set|jobs).go
- linters: [dupl]
path: main.go
- linters:
- importas
text: has alias "" which is not part of config # Ignore false positives that emerged due to https://github.com/julz/importas/issues/15.