forked from kedacore/keda
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.golangci.yml
177 lines (175 loc) · 5.79 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
# options for analysis running
run:
# default concurrency is a available CPU number
concurrency: 4
# add the build tags to include e2e tests files
build-tags:
- e2e
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 10m
# skip vendor directory
skip-dirs:
- vendor
modules-download-mode: vendor
linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- typecheck
- dupl
- goprintffuncname
- govet
- nolintlint
#- rowserrcheck
- gofmt
- revive
- goimports
- misspell
- bodyclose
- unconvert
- ineffassign
- staticcheck
- exportloopref
- depguard
- dogsled
- errcheck
#- funlen
- gci
- goconst
- gocritic
- gocyclo
- gosimple
- stylecheck
- unused
- unparam
- unconvert
- whitespace
issues:
include:
- EXC0002 # disable excluding of issues about comments from golint
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd
- dupl
- revive
- goconst
- path: scalers_builder.go
linters:
- gocyclo
- path: scale_scaledobjects.go
linters:
- gocyclo
# Exclude for clustertriggerauthentication_controller and triggerauthentication_controller, reason:
# controllers/clustertriggerauthentication_controller.go:1: 1-59 lines are duplicate of `controllers/triggerauthentication_controller.go:1-58` (dupl)
- path: triggerauthentication_controller.go
linters:
- dupl
# https://github.com/go-critic/go-critic/issues/926
- linters:
- gocritic
text: "unnecessaryDefer:"
- linters:
- stylecheck
text: "ST1000:"
# The call to autorest.Send() in scalers/azure_app_insights.go is marked as not closing the response body. However, autorest.DoCloseIfError()
# and autorest.ByClosing() should ensure that the response body is closed.
- path: azure/azure_app_insights.go
linters:
- bodyclose
# Exclude for stan_scaler and nats_jetstream_scaler, reason:
# pkg/scalers/nats_jetstream_scaler.go:109: 109-153 lines are duplicate of `pkg/scalers/stan_scaler.go:83-127` (dupl)
- path: nats_jetstream_scaler.go
linters:
- dupl
# Exclude for stan_scaler and nats_jetstream_scaler, reason:
# pkg/scalers/stan_scaler.go:83: 83-127 lines are duplicate of `pkg/scalers/nats_jetstream_scaler.go:109-153` (dupl)
- path: stan_scaler.go
linters:
- dupl
# Exclude for datadog_scaler, reason:
# Introduce new parameters to fix DataDog API response issue #3906 (PR #3954)
- path: datadog_scaler.go
linters:
- gocyclo
# Exclude for kafka_scaler, reason:
# Introduce new parameters to set number of partitions w/lag issue #3997 (PR #5060)
- path: kafka_scaler.go
linters:
- gocyclo
# Exclude for apache_kafka_scaler, reason:
# Introduce new parameters to set number of partitions w/lag issue #3997 (PR #5060)
- path: apache_kafka_scaler.go
linters:
- gocyclo
# Exclude for mongo_scaler and couchdb_scaler, reason:
# pkg/scalers/couchdb_scaler.go:144: 144-174 lines are duplicate of `pkg/scalers/mongo_scaler.go:155-185` (dupl)
- path: couchdb_scaler.go
linters:
- dupl
# Exclude for mongo_scaler and couchdb_scaler, reason:
# pkg/scalers/mongo_scaler.go:155: 155-185 lines are duplicate of `pkg/scalers/couchdb_scaler.go:144-174` (dupl)
- path: mongo_scaler.go
linters:
- dupl
# Exclude gci check for //+kubebuilder:scaffold:imports comments. Waiting to
# resolve https://github.com/kedacore/keda/issues/4379
- path: cmd/operator/main.go
linters:
- gci
- path: cmd/webhooks/main.go
linters:
- gci
- path: controllers/keda/suite_test.go
linters:
- gci
- path: apis/keda/v1alpha1/scaledobject_webhook_test.go
linters:
- gci
# Exclude for azure_pipelines_scaler, reason:
# pkg/scalers/azure_pipelines_scaler.go:408:10: badCond: `countDemands == len(demandsInJob) && countDemands == len(demandsInScaler)` condition is suspicious (gocritic)
- path: azure_pipelines_scaler.go
linters:
- gocritic
# Following 3 depguard exceptions are for disabling sync/atomic package where
# denying the rule doesnt help (bottom of this file) but this keeps the depguard
# linter enabled
# https://github.com/kedacore/keda/issues/4980
- path: pkg/scalers/external_mock_scaler.go
linters:
- depguard
- path: controllers/keda/scaledobject_controller_test.go
linters:
- depguard
- goconst
- path: pkg/scalers/external_scaler_test.go
linters:
- depguard
# Exclude for scale_resolvers, reason:
# pkg/scaling/resolver/scale_resolvers.go:236:1: cyclomatic complexity 35 of func `resolveAuthRef` is high (> 30) (gocyclo)
- path: pkg/scaling/resolver/scale_resolvers.go
linters:
- gocyclo
# Exclude for azure_storage, reason:
# pkg/scalers/azure/azure_storage.go:91: 91-120 lines are duplicate of `pkg/scalers/azure/azure_storage.go:123-152` (dupl)
# pkg/scalers/azure/azure_storage.go:123: 123-152 lines are duplicate of `pkg/scalers/azure/azure_storage.go:91-120` (dupl)
- path: pkg/scalers/azure/azure_storage.go
linters:
- dupl
linters-settings:
funlen:
lines: 80
statements: 40
gci:
sections:
- standard
- default
- prefix(github.com/kedacore/keda)
depguard: #https://github.com/kedacore/keda/issues/4980
rules:
main:
deny:
- pkg: sync/atomic
desc: "use type-safe atomics from go.uber.org/atomic"