-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.golangci.yaml
919 lines (847 loc) · 20.9 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
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
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
# last revision for golangci-lint version 1.50.1
run:
timeout: 1m
issues-exit-code: 1
tests: true
build-tags: [ ]
skip-dirs: [ ]
skip-dirs-use-default: true
skip-files: [ ]
modules-download-mode: readonly
allow-parallel-runners: true
go: '1.19'
output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
path-prefix: ""
sort-results: true
linters-settings:
asasalint:
exclude:
- Append
- \.Wrapf
use-builtin-exclusions: true
ignore-test: true
bidichk:
left-to-right-embedding: true
right-to-left-embedding: true
pop-directional-formatting: true
left-to-right-override: true
right-to-left-override: true
left-to-right-isolate: true
right-to-left-isolate: true
first-strong-isolate: true
pop-directional-isolate: true
cyclop:
max-complexity: 10
package-average: 1.5
skip-tests: true
decorder:
disable-dec-order-check: true
disable-init-func-first-check: false
disable-dec-num-check: true
depguard:
list-type: denylist
include-go-root: false
packages:
- github.com/pkg/errors
packages-with-error-message:
- github/com/pkg/errors: 'use "fmt" and "errors" packages instead'
ignore-file-rules: []
additional-guards: []
dogsled:
max-blank-identifiers: 2
dupl:
threshold: 200
dupword:
keywords:
- "the"
- "and"
- "or"
- "a"
- "license"
errcheck:
check-type-assertions: true
check-blank: true
disable-default-exclusions: false
exclude-functions: []
errchkjson:
check-error-free-encoding: false
report-no-exported: true
errorlint:
errorf: true
asserts: true
comparison: true
exhaustive:
check:
- switch
- map
check-generated: true
default-signifies-exhaustive: true
ignore-enum-members: ""
package-scope-only: false
explicit-exhaustive-switch: false
explicit-exhaustive-map: false
exhaustruct:
include: []
exclude:
- '.*_test'
- 'wrapper'
forbidigo:
forbid: ["^(fmt\\.Print(|f|ln)|print|println)$"]
exclude_godoc_examples: true
funlen:
lines: 60
statements: 40
gocognit:
min-complexity: 10
goconst:
min-len: 2
min-occurrences: 2
ignore-tests: false
match-constant: true
numbers: false
gocritic:
# enabled-checks: [] # by default, list of stable checks is used
disabled-checks:
- tooManyResultsChecker # revive will take care
enabled-tags:
- diagnostic
- style
- performance
- experimental
- opinionated
disabled-tags: []
settings:
captLocal:
paramsOnly: true
elseif:
skipBalanced: true
hugeParam:
sizeThreshold: 70
nestingReduce:
bodyWidth: 4
rangeExprCopy:
sizeThreshold: 516
skipTestFuncs: false
rangeValCopy:
sizeThreshold: 32
skipTestFuncs: true
truncateCmp:
skipArchDependent: false
underef:
skipRecvDeref: true
godot:
scope: toplevel
exclude:
- "^fixme:"
- "^todo:"
- "^TODO:"
period: true
capital: true
godox:
keywords:
- TODO
- BUG
- FIXME
gofmt:
simplify: false
rewrite-rules: []
gofumpt:
module-path: github.com/dnozdrin/errdetail
extra-rules: true
goheader:
template: |-
Copyright 2022 Dmytro Nozdrin. All rights reserved.
Use of this source code is governed by the MIT License
that can be found in the LICENSE file.
goimports:
local-prefixes: ""
gomnd:
checks:
- argument
- case
- condition
- operation
- return
- assign
ignored-numbers: []
ignored-files: []
ignored-functions:
- 'math.*'
gomoddirectives:
replace-local: true
replace-allow-list:
- github.com/dnozdrin/errdetail
retract-allow-no-explanation: false
exclude-forbidden: true
gomodguard:
allowed:
modules: []
domains: []
blocked:
modules: []
versions: []
local_replace_directives: false
gosimple:
checks: ["*"]
gosec:
includes:
- G101 # Look for hard coded credentials
- G102 # Bind to all interfaces
- G103 # Audit the use of unsafe block
- G104 # Audit errors not checked
- G106 # Audit the use of ssh.InsecureIgnoreHostKey
- G107 # Url provided to HTTP request as taint input
- G108 # Profiling endpoint automatically exposed on /debug/pprof
- G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32
- G110 # Potential DoS vulnerability via decompression bomb
- G111 # Potential directory traversal
- G112 # Potential slowloris attack
- G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772)
- G114 # Use of net/http serve function that has no support for setting timeouts
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G203 # Use of unescaped data in HTML templates
- G204 # Audit use of command execution
- G301 # Poor file permissions used when creating a directory
- G302 # Poor file permissions used with chmod
- G303 # Creating tempfile using a predictable path
- G304 # File path provided as taint input
- G305 # File traversal when extracting zip/tar archive
- G306 # Poor file permissions used when writing to a new file
- G307 # Deferring a method which returns an error
- G401 # Detect the usage of DES, RC4, MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
- G501 # Import blocklist: crypto/md5
- G502 # Import blocklist: crypto/des
- G503 # Import blocklist: crypto/rc4
- G504 # Import blocklist: net/http/cgi
- G505 # Import blocklist: crypto/sha1
- G601 # Implicit memory aliasing of items from a range statement
excludes: []
exclude-generated: false
severity: low
confidence: low
# concurrency: 12 # rely on the number of logical CPUs usable by the current process.
config:
global:
nosec: false
"#nosec": ""
show-ignored: false
# Audit mode enables addition checks that for normal code analysis might be too nosy.
# Default: false
audit: true
G101:
pattern: "(?i)passwd|pass|password|pwd|secret|token|pw|apiKey|bearer|cred"
ignore_entropy: false
entropy_threshold: "80.0"
per_char_threshold: "3.0"
truncate: "32"
G104: # Additional functions to ignore while checking unhandled errors.
bytes.Buffer:
- Write
- WriteByte
- WriteRune
- WriteString
fmt:
- Print
- Printf
- Println
- Fprint
- Fprintf
- Fprintln
strings.Builder:
- Write
- WriteByte
- WriteRune
- WriteString
io.PipeWriter:
- CloseWithError
hash.Hash:
- Write
os:
- Unsetenv
G111:
# Regexp pattern to find potential directory traversal.
pattern: "http\\.Dir\\(\"\\/\"\\)|http\\.Dir\\('\\/'\\)"
# Maximum allowed permissions mode for os.Mkdir and os.MkdirAll
G301: "0750"
# Maximum allowed permissions mode for os.OpenFile and os.Chmod
G302: "0600"
# Maximum allowed permissions mode for os.WriteFile and ioutil.WriteFile
G306: "0600"
govet:
check-shadowing: true
settings:
shadow:
strict: false
enable:
- asmdecl
- assign
- atomic
- atomicalign
- bools
- buildtag
- cgocall
- composites
- copylocks
- deepequalerrors
- errorsas
- findcall
- framepointer
- httpresponse
- ifaceassert
- loopclosure
- lostcancel
- nilfunc
- nilness
- printf
- reflectvaluecompare
- shadow
- shift
- sigchanyzer
- sortslice
- stdmethods
- stringintconv
- structtag
- testinggoroutine
- tests
- unmarshal
- unreachable
- unsafeptr
- unusedresult
- unusedwrite
disable: []
grouper:
const-require-single-const: false
const-require-grouping: false
import-require-single-import: true
import-require-grouping: true
type-require-single-type: false
type-require-grouping: false
var-require-single-var: false
var-require-grouping: false
importas:
no-unaliased: true
no-extra-aliases: true
alias: []
interfacebloat:
max: 5
ireturn:
allow:
- anon
- error
- empty
- stdlib
# - (or|er)$
reject: []
loggercheck:
kitlog: false
klog: false
logr: false
zap: false
require-string-key: true
no-printf-like: true
rules: []
maintidx:
under: 20
misspell:
ignore-words: []
nakedret:
max-func-lines: 30
nestif:
min-complexity: 5
nilnil:
checked-types:
- ptr
- func
- iface
- map
- chan
nlreturn:
block-size: 2
nolintlint:
allow-unused: false
allow-no-explanation: [ ]
require-explanation: true
require-specific: true
nonamedreturns:
report-error-in-defer: false
paralleltest:
ignore-missing: true
prealloc:
simple: false
range-loops: true
for-loops: true
predeclared:
ignore: "new,int"
q: false
promlinter:
strict: true
disabled-linters: []
reassign:
patterns:
- ".*"
revive:
max-open-files: 2048
ignore-generated-header: true
severity: warning
enable-all-rules: false
confidence: 0.5
rules:
- name: add-constant
severity: warning
disabled: false
arguments:
- maxLitCount: "3"
allowStrs: '"","dummy_code","dummy description","dummy message","dummy field","dummy message: "'
allowInts: "0,1,2"
allowFloats: "0.0,0.,1.0,1.,2.0,2."
- name: argument-limit
severity: warning
disabled: false
arguments: [ 4 ]
- name: atomic
severity: warning
disabled: false
- name: banned-characters
severity: warning
disabled: true
arguments: []
- name: bare-return
severity: warning
disabled: false
- name: blank-imports
severity: warning
disabled: false
- name: bool-literal-in-expr
severity: warning
disabled: false
- name: call-to-gc
severity: warning
disabled: false
- name: cognitive-complexity
severity: warning
disabled: false
arguments: [ 10 ]
- name: confusing-naming
severity: warning
disabled: false
- name: confusing-results
severity: warning
disabled: false
- name: constant-logical-expr
severity: warning
disabled: false
- name: context-as-argument
severity: warning
disabled: false
arguments:
- allowTypesBefore: "*testing.T,"
- name: context-keys-type
severity: warning
disabled: false
- name: cyclomatic
severity: warning
disabled: false
arguments: [ 8 ]
- name: datarace
severity: warning
disabled: false
- name: deep-exit
severity: warning
disabled: false
- name: defer
severity: warning
disabled: false
arguments:
- [ "call-chain", "loop" , "recover", "immediate-recover", "return"]
- name: dot-imports
severity: warning
disabled: false
- name: duplicated-imports
severity: warning
disabled: false
- name: early-return
severity: warning
disabled: false
- name: empty-block
severity: warning
disabled: false
- name: empty-lines
severity: warning
disabled: false
- name: error-naming
severity: warning
disabled: false
- name: error-return
severity: warning
disabled: false
- name: error-strings
severity: warning
disabled: false
- name: errorf
severity: warning
disabled: false
- name: exported
severity: warning
disabled: false
arguments:
- "checkPrivateReceivers"
- "sayRepetitiveInsteadOfStutters"
- name: file-header
severity: warning
disabled: true
arguments: []
- name: flag-parameter
severity: warning
disabled: false
- name: function-result-limit
severity: warning
disabled: false
arguments: [ 2 ]
- name: function-length
severity: warning
disabled: false
arguments: [ 15, 0 ]
- name: get-return
severity: warning
disabled: false
- name: identical-branches
severity: warning
disabled: false
- name: if-return
severity: warning
disabled: false
- name: increment-decrement
severity: warning
disabled: false
- name: indent-error-flow
severity: warning
disabled: false
- name: imports-blacklist
severity: warning
disabled: true
arguments: []
- name: import-shadowing
severity: warning
disabled: false
- name: line-length-limit
severity: warning
disabled: false
arguments: [ 120 ]
- name: max-public-structs
severity: warning
disabled: false
arguments: [ 5 ]
- name: modifies-parameter
severity: warning
disabled: false
- name: modifies-value-receiver
severity: warning
disabled: false
- name: nested-structs
severity: warning
disabled: false
- name: optimize-operands-order
severity: warning
disabled: false
- name: package-comments
severity: warning
disabled: false
- name: range
severity: warning
disabled: false
- name: range-val-in-closure
severity: warning
disabled: false
- name: range-val-address
severity: warning
disabled: false
- name: receiver-naming
severity: warning
disabled: false
- name: redefines-builtin-id
severity: warning
disabled: false
- name: string-of-int
severity: warning
disabled: false
- name: string-format
severity: warning
disabled: false
arguments: [
[ "core.WriteError[1].Message", "/^([^A-Z]|$)/", "must not start with a capital letter"],
[ "fmt.Errorf[0]", "/(^|[^\\.!?])$/", "must not end in punctuation"],
[ "panic", "/^[^\\n]*$/", "must not contain line breaks"]
]
- name: struct-tag
severity: warning
disabled: false
- name: superfluous-else
severity: warning
disabled: false
- name: time-equal
severity: warning
disabled: false
- name: time-naming
severity: warning
disabled: false
- name: var-naming
severity: warning
disabled: false
arguments:
- [ "ID" ] # AllowList
- [ "Id", "Info" ] # DenyList
- name: var-declaration
severity: warning
disabled: false
- name: unconditional-recursion
severity: warning
disabled: false
- name: unexported-naming
severity: warning
disabled: false
- name: unexported-return
severity: warning
disabled: false
- name: unhandled-error
severity: warning
disabled: true
arguments: []
- name: unnecessary-stmt
severity: warning
disabled: false
- name: unreachable-code
severity: error
disabled: false
- name: unused-parameter
severity: error
disabled: false
- name: unused-receiver
severity: error
disabled: false
- name: useless-break
severity: warning
disabled: false
- name: waitgroup-by-value
severity: error
disabled: false
rowserrcheck:
packages: []
staticcheck:
checks: ["*"]
stylecheck:
checks: [ "*" ]
dot-import-whitelist: []
initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS" ]
http-status-code-whitelist: []
tagliatelle:
case:
use-field-name: true
rules:
json: camel
yaml: camel
xml: camel
bson: camel
avro: snake
tenv:
all: true
testpackage:
skip-regexp: (export|internal)_test\.go
allow-packages:
- example
- main
- test
thelper:
test:
first: 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: true
time-layout: true
crypto-hash: true
default-rpc-path: true
os-dev-null: true
sql-isolation-level: true
tls-signature-scheme: true
constant-kind: true
syslog-priority: true
unparam:
check-exported: false
varnamelen:
max-distance: 15
min-name-length: 3
check-receiver: true
check-return: true
check-type-param: true
ignore-type-assert-ok: false
ignore-map-index-ok: false
ignore-chan-recv-ok: false
ignore-names:
- err
- tt
ignore-decls:
- c echo.Context
- t testing.T
- f *foo.Bar
- e error
- i int
- const C
- T any
- m map[string]int
whitespace:
multi-if: true
multi-func: true
wrapcheck:
ignoreSigs:
- .Errorf(
- errors.New(
- errdetail.Wrap(
- errdetail.New(
ignoreSigRegexps:
- \.New.*Error\(
ignorePackageGlobs: []
wsl:
strict-append: true
allow-assign-and-call: true
allow-assign-and-anything: false
allow-multiline-assign: false
force-case-trailing-whitespace: 1
allow-trailing-comment: false
allow-separated-leading-comment: true
allow-cuddle-declarations: false
allow-cuddle-with-calls: [ "Lock", "RLock" ]
allow-cuddle-with-rhs: [ "Unlock", "RUnlock" ]
enforce-err-cuddling: true
error-variable-names: [ "err" ]
force-short-decl-cuddling: true
linters:
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
- cyclop
- decorder
- depguard
- dogsled
- dupl
- dupword
- errcheck
- errchkjson
- errname
- errorlint
# - execinquery # no need for this package
- exhaustive
- exhaustruct
- exportloopref
- forbidigo
- forcetypeassert
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- godot
- godox
- goerr113
- gofmt
- gofumpt
- goheader
- goimports
- gomnd
- gomoddirectives
# - gomodguard # no need for this package for a while
- goprintffuncname
- gosec
- gosimple
- govet
- grouper
# - importas # no need for this package
- ineffassign
- interfacebloat
- ireturn
# - loggercheck # no need for this package
- maintidx
- misspell
# - nakedret # revive takes care of it
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- paralleltest
- prealloc
- predeclared
# - promlinter # no need for this package
- reassign
- revive
# - rowserrcheck # no need for this package
# - sqlclosecheck # no need for this package
- staticcheck
- stylecheck
- tagliatelle
- tenv
- testableexamples
- testpackage
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- varnamelen
# - wastedassign # don't work as expected, see https://github.com/golangci/golangci-lint/issues/2649
- whitespace
- wrapcheck
- wsl
presets: []
fast: false
issues:
exclude-rules:
- path: _test\.go
linters:
- funlen
exclude-use-default: true
exclude-case-sensitive: false
include:
- EXC0001
- EXC0009
max-issues-per-linter: 50
max-same-issues: 20
new: false # no need for this package for a while
new-from-rev: HEAD
fix: false
severity:
default-severity: error
case-sensitive: false
rules: []