-
Notifications
You must be signed in to change notification settings - Fork 2
/
.golangci.yml
596 lines (513 loc) · 10.3 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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
---
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
# https://golangci-lint.run/jsonschema/golangci.jsonschema.json
run:
skip-files:
# - .*\.my\.go$
# - lib/bad.go
# goplicate-start:run
timeout: 1m
issues-exit-code: 1
tests: true
skip-dirs-use-default: true
modules-download-mode: readonly
allow-parallel-runners: false
# goplicate-end:run
# goplicate-start:severity
severity:
case-sensitive: false
# goplicate-end:severity
# goplicate-start:linters
linters:
disable-all: true
enable:
- decorder
- dogsled
- dupl
- dupword
- errcheck
- errchkjson
- errorlint
- exhaustive
- funlen
- gocognit
- goconst
- gocritic
- godox
- gofmt
- goimports
- gomnd
- gosec
- gosimple
- govet
- importas
- interfacebloat
- lll
- maintidx
- makezero
- misspell
- nakedret
- nestif
- nilnil
- nlreturn
- nonamedreturns
- paralleltest
# - revive: @TODO: Review and enable
- sloglint
- staticcheck
- stylecheck
- tagalign
- tagliatelle
- thelper
- unparam
- unused
- usestdlibvars
- whitespace
- wrapcheck
- wsl
# goplicate-end:linters
# goplicate-start:output
output:
formats:
- path: stdout
format: colored-line-number
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
path-prefix: ''
sort-results: true
# goplicate-end:output
# goplicate-start:linters-settings
linters-settings:
decorder:
disable-dec-order-check: false
disable-init-func-first-check: false
disable-dec-num-check: false
dec-order:
- const
- var
- type
- func
dogsled:
max-blank-identifiers: 2
dupl:
threshold: 100
dupword:
keywords:
- a
- an
- and
- of
- or
- the
- this
errcheck:
check-type-assertions: true
check-blank: false
errchkjson:
check-error-free-encoding: false
report-no-exported: false
errorlint:
errorf: true
asserts: true
comparison: true
exhaustive:
check-generated: true
default-signifies-exhaustive: true
package-scope-only: false
explicit-exhaustive-switch: false
explicit-exhaustive-map: false
check:
- switch
- map
exhaustruct:
funlen:
lines: -1
statements: -1
ignore-comments: true
gocognit:
min-complexity: 20
goconst:
min-len: 80
min-occurrences: 3
ignore-tests: false
match-constant: true
numbers: false
ignore-calls: true
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-tags: []
settings:
captLocal:
paramsOnly: true
elseif:
skipBalanced: true
hugeParam:
sizeThreshold: 80
nestingReduce:
bodyWidth: 5
rangeExprCopy:
sizeThreshold: 512
skipTestFuncs: true
rangeValCopy:
sizeThreshold: 128
skipTestFuncs: true
ruleguard:
tooManyResultsChecker:
maxResults: 20
truncateCmp:
skipArchDependent: true
underef:
skipRecvDeref: true
unnamedResult:
checkExported: false
godox:
keywords:
- BUG
- FIXME
- HACK
- NOTE
- OPTIMIZE
- TODO
- '@TODO'
gofmt:
simplify: true
rewrite-rules:
- pattern: interface{}
replacement: any
- pattern: a[b:len(a)]
replacement: a[b:]
goimports:
gomnd:
checks:
- argument
- case
- condition
- operation
- return
- assign
ignored-numbers:
- '0666'
- '0755'
gosimple:
checks: ['*']
gosec:
exclude-generated: true
severity: low
confidence: medium
config:
global:
nosec: false
show-ignored: false
audit: true
G101:
ignore_entropy: false
entropy_threshold: '80.0'
per_char_threshold: '3.0'
truncate: '16'
G104:
fmt:
- Fscanf
G111:
pattern: custom\.Dir\(\)
G301: '0750'
G302: '0600'
G306: '0666'
govet:
enable:
- appends
- asmdecl
- assign
- atomic
- atomicalign
- bools
- buildtag
- cgocall
- composites
- copylocks
- deepequalerrors
- defers
- directive
- errorsas
- fieldalignment
- findcall
- framepointer
- httpresponse
- ifaceassert
- loopclosure
- lostcancel
- nilfunc
- nilness
- printf
- reflectvaluecompare
- shadow
- shift
- sigchanyzer
- slog
- sortslice
- stdmethods
- stringintconv
- structtag
- testinggoroutine
- tests
- unmarshal
- unreachable
- unsafeptr
- unusedresult
- unusedwrite
settings:
asmdecl: {}
assign: {}
atomic: {}
bools: {}
buildtag: {}
composites:
whitelist: true
copylocks: {}
loopclosure: {}
lostcancel: {}
nilfunc: {}
printf:
funcs: true
shift: {}
stdmethods: {}
structtag: {}
unmarshal: {}
unreachable: {}
unsafeptr: {}
unusedresult:
funcs: true
stringmethods: true
importas:
no-unaliased: true
no-extra-aliases: false
interfacebloat:
max: 10
lll:
line-length: 120
tab-width: 1
maintidx:
under: 20
makezero:
always: false
misspell:
locale: US
nakedret:
max-func-lines: 30
nestif:
min-complexity: 10
nilnil:
checked-types:
- ptr
- func
- iface
- map
- chan
nlreturn:
block-size: 2
nonamedreturns:
report-error-in-defer: false
paralleltest:
ignore-missing: true
ignore-missing-subtests: true
# revive: @TODO: Review and enable.
sloglint:
kv-only: true
attr-only: false
no-raw-keys: true
args-on-sep-lines: false
staticcheck:
checks: ['*']
stylecheck:
checks: ['*']
tagalign:
align: true
sort: true
strict: true
tagliatelle:
case:
use-field-name: false
rules:
avro: snake
bson: camel
env: upperSnake
envconfig: upperSnake
ini: snake
json: camel
mapstructure: kebab
toml: snake
xml: camel
yaml: camel
thelper:
test:
first: true
name: true
begin: true
benchmark:
first: true
name: true
begin: true
tb:
first: true
name: true
begin: true
fuzz:
first: true
name: true
begin: true
usestdlibvars:
http-method: true
http-status-code: true
time-weekday: true
time-month: false
time-layout: false
crypto-hash: false
default-rpc-path: false
sql-isolation-level: false
tls-signature-scheme: false
constant-kind: false
unparam:
check-exported: false
unused:
field-writes-are-uses: true
post-statements-are-reads: false
exported-is-used: true
exported-fields-are-used: true
parameters-are-used: true
local-variables-are-used: true
generated-is-used: true
whitespace:
multi-if: false
multi-func: false
wrapcheck:
ignoreSigs:
- .Errorf(
- errors.New(
- errors.Unwrap(
- .Wrap(
- .Wrapf(
- .WithMessage(
- .WithMessagef(
- .WithStack(
wsl:
allow-assign-and-anything: false
allow-assign-and-call: true
allow-cuddle-declarations: false
allow-cuddle-with-calls: [Lock, RLock]
allow-cuddle-with-rhs: [Unlock, RUnlock]
allow-multiline-assign: true
allow-separated-leading-comment: true
allow-trailing-comment: false
error-variable-names: [err]
force-case-trailing-whitespace: 0
force-err-cuddling: false
force-short-decl-cuddling: false
strict-append: true
# goplicate-end:linters-settings
# goplicate-start:issues
issues:
exclude-case-sensitive: false
exclude-use-default: false
fix: false
max-issues-per-linter: 0
max-same-issues: 0
new: false
exclude-rules:
- linters:
- lll
source: lint:ignore_length
- linters:
- gosec
source: lint:allow_666
- linters:
- gosec
source: lint:allow_possible_insecure
- linters:
- unparam
source: lint:allow_param
- linters:
- gomnd
source: lint:allow_raw_number
- text: 'commentedOutCode: may want to remove commented-out code'
linters:
- gocritic
source: lint:allow_commented
- linters:
- nestif
source: lint:allow_nesting
- linters:
- dupl
source: lint:no_dupe
- linters:
- goerr113
source: lint:allow_errorf
- linters:
- wrapcheck
source: lint:allow_unwrapped_errors
- text: (SA1019|G402)
linters:
- staticcheck
- gosec
source: lint:allow_tls_min_version
- text: (returns interface)
linters:
- ireturn
source: lint:allow_return_interface
- text: (G101)
linters:
- gosec
source: lint:not_a_secret
- text: (G104)
linters:
- gosec
source: lint:allow_unhandled
- text: (G404)
linters:
- gosec
source: lint:not_crypto
- text: (error-strings)
linters:
- revive
source: lint:allow_human_errors
- text: (hugeParam)
linters:
- gocritic
source: lint:allow_large_memory
- linters:
- tagliatelle
- gofumpt
source: lint:allow_format
- text: (is unused)
linters:
- unused
source: lint:allow_unused
- text: (is a program, not an importable package)
linters:
- typecheck
source: lint:allow_importable_program
- text: (don't use `init` function)
linters:
- gochecknoinits
source: lint:allow_init
- text: (cuddle)
linters:
- wsl
source: lint:allow_cuddle
- text: (ST1000)
linters:
- stylecheck
source: lint:allow_no_pkg_comment
- text: (cognitive complexity)
linters:
- gocognit
source: lint:allow_complexity
- text: (make it a constant)
linters:
- goconst
source: lint:no_const
# goplicate-end:issues