-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
335 lines (335 loc) · 6.84 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
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
run:
timeout: 1m
build-tags: []
output:
print-issued-lines: false
sort-results: true
linters-settings:
cyclop:
max-complexity: 10
package-average: 2
skip-tests: true
decorder:
disable-dec-order-check: false
disable-dec-num-check: true
errcheck:
severity: Warn
check-type-assertions: true
check-blank: true
ignore: ""
disable-default-exclusions: false
errchkjson:
severity: Warn
report-no-exported: true
errorlint:
asserts: true
exhaustive:
check:
- switch
- map
check-generated: true
default-signifies-exhaustive: true
funlen:
lines: 69
statements: 40
ignore-comments: true
gocognit:
min-complexity: 30
nestif:
min-complexity: 5
gocritic:
enabled-tags:
- diagnostic
- style
- performance
- experimental
- opinionated
disabled-checks:
- commentedOutCode # TODO
- dupImport
settings:
captLocal:
paramsOnly: false
elseif:
skipBalanced: true
hugeParam:
sizeThreshold: 80
nestingReduce:
bodyWidth: 5
rangeExprCopy:
sizeThreshold: 512
skipTestFuncs: true
rangeValCopy:
sizeThreshold: 128
skipTestFuncs: true
truncateCmp:
skipArchDependent: true
underef:
skipRecvDeref: true
gocyclo:
min-complexity: 235
goconst:
min-occurrences: 5
godot:
scope: all # comments to be checked: `declarations`, `toplevel`, or `all`
gofmt:
simplify: true
gosec:
config:
G302: "0640"
G306: "0640"
govet:
enable-all: true
settings:
shadow:
strict: true
ireturn:
allow:
- empty
- error
- stdlib
- generic
lll:
line-length: 120
tab-width: 1
nakedret:
max-func-lines: 30
prealloc:
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: false # Report preallocation suggestions on for loops, false by default
predeclared:
ignore: ""
q: false
nlreturn:
block-size: 2
nolintlint:
allow-unused: false
allow-no-explanation: []
require-explanation: true
require-specific: true
testpackage:
skip-regexp: (export|internal)_test\.go
thelper:
test:
first: true
name: true
begin: true
benchmark:
first: true
name: true
begin: true
tb:
first: true
name: true
begin: true
unparam:
check-exported: false
unused:
field-writes-are-uses: true
post-statements-are-reads: false
# FIXME: setting the below to false crashes.
# We need this check in order to get rid of `deadcode` linter.
exported-is-used: true
exported-fields-are-used: false
parameters-are-used: true
local-variables-are-used: false
generated-is-used: false
varnamelen:
max-distance: 14
min-name-length: 2
check-receiver: false
check-return: true
check-type-param: true
ignore-type-assert-ok: true
ignore-map-index-ok: true
ignore-chan-recv-ok: true
ignore-names:
- err
ignore-decls:
- T any
- f *os.File
- g *errgroup.Group
- q *Query
- n *Node
- m *QueryMatch
wsl:
severity: warning
strict-append: true
allow-assign-and-call: true
allow-multiline-assign: true
allow-cuddle-declarations: false
allow-trailing-comment: false
force-case-trailing-whitespace: 0
force-err-cuddling: false
allow-separated-leading-comment: false
gofumpt:
extra-rules: true
makezero:
always: false
linters:
fast: false
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar # NOT needed post 1.22.0
- cyclop
- decorder
- depguard
- dogsled
- dupl
- dupword
- durationcheck
- err113
- errcheck # default
- errchkjson
- errname
- errorlint
- exhaustive
#- exhaustruct
- fatcontext
- forbidigo
- forcetypeassert
- funlen
#- gci # we use gofumpt
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals # we want some globals for now, but we should reduce them to bare minimum
- gochecknoinits # we want init()s for now
- gochecksumtype
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- gofmt
- gofumpt
- goheader
- goimports
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple # default
- gosmopolitan
- govet # default
- grouper
- importas
- inamedparam
- ineffassign # default
- interfacebloat
- intrange
- ireturn
- lll
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
#- nonamedreturns # we want named returns
- nosprintfhostport
- paralleltest
- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck # default
- stylecheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- testifylint
#- testpackage
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused # default
- usestdlibvars
- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl
#- zerologlint # we don't use it
issues:
exclude:
- binding_test.go
exclude-rules:
- path: _test\.go
linters:
- decorder
- funlen
- gocognit
- godot
- goerr113
- govet
- varnamelen
- linters:
- staticcheck
text: "SA9003:"
- linters:
- revive
text: "exported: exported method [a-zA-Z]*.(Unm|M)arshalJSON should have comment or be unexported"
- linters:
- lll
source: "^//go:generate "
- linters:
- gosec
text: G104 # doubles errcheck error handling check
- linters:
- gosec
text: G601 # no longer an issue in 1.22+
- linters:
- gosec
text: G304 # way too many false positives about "file inclusion"
- path: _test\.go
linters:
- gosec
text: G404 # math/rand is just fine in tests
- path: _test\.go
linters:
- gocritic
text: rangeValCopy
exclude-use-default: false
exclude-case-sensitive: false
max-issues-per-linter: 0
max-same-issues: 0
new: false
fix: false
severity:
default-severity: Info
case-sensitive: false
rules:
- linters:
- errcheck
- gosec
severity: Warn
- linters:
- contextcheck
severity: Hint