-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
203 lines (200 loc) · 5.23 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
linters-settings:
funlen:
lines: 350
statements: 135
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
dupl:
threshold: 100
errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors.
# See the https://github.com/polyfloyd/go-errorlint for caveats.
# Default: true
errorf: false
# Permit more than 1 %w verb, valid per Go 1.20 (Requires errorf:true)
# Default: true
errorf-multi: true
# Check for plain type assertions and type switches.
# Default: true
asserts: true
# Check for plain error comparisons.
# Default: true
comparison: true
exhaustive:
# Program elements to check for exhaustiveness.
# Default: [ switch ]
check:
- switch
- map
# Check switch statements in generated files also.
# Default: false
check-generated: true
# Presence of "default" case in switch statements satisfies exhaustiveness,
# even if all enum members are not listed.
# Default: false
default-signifies-exhaustive: true
# Enum members matching the supplied regex do not have to be listed in
# switch statements to satisfy exhaustiveness.
# Default: ""
ignore-enum-members: "Example.+"
# Enum types matching the supplied regex do not have to be listed in
# switch statements to satisfy exhaustiveness.
# Default: ""
ignore-enum-types: "Example.+"
# Consider enums only in package scopes, not in inner scopes.
# Default: false
package-scope-only: true
# Only run exhaustive check on switches with "//exhaustive:enforce" comment.
# Default: false
explicit-exhaustive-switch: false
# Only run exhaustive check on map literals with "//exhaustive:enforce" comment.
# Default: false
explicit-exhaustive-map: false
gci:
local-prefixes: github.com/datatrails/go-datatrails-merklelog
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- performance
- style
- experimental
disabled-checks:
- wrapperFunc
gocognit:
min-complexity: 75
gocyclo:
min-complexity: 10
goimports:
local-prefixes: github.com/golangci/golangci-lint
golint:
min-confidence: 0
govet:
check-shadowing: true
settings:
printf:
funcs:
- Infof
- Warnf
- Errorf
- Fatalf
lll:
line-length: 500
maligned:
suggest-new: true
misspell:
locale: UK
# depguard (control upstream repos) not needed
# dupl - see ticket #3095
# funlen - it is to anoying for test code and this sort of subjective judgement is what PR reviews are for
# exhaustive - see ticket #3096
# gci - disabled as confusing and not really useful
# gochecknoglobals - not really useful
# goconst - see ticket #3097
# goerr113 - disabled see https://github.com/Djarvur/go-err113/issues/10
# gofumpt - not useful - confusing messages
# gomnd - see ticket #3116
# govet - see ticket #3117
# nilreturn onwardis not yet evaluated...
# maligned - this guards against performance issues due to accessing
# mis-aligned structs. We don't have direct evidence of this being a
# real problem for us. We use a lot of generated code in our hot
# paths anyway (we have no control over there layout). Until we get
# direct evidence this is hurting us, we prefer our stucts layed out
# logically and don't want to have to nolint tag everything.
#
# misspell - expected UK spelling with misspell, but customer facing text needs to be US.
# tagalign - suppress until we can get a golang code formatter that will fix this (cosmetic)
#
# WARN: typecheck cannot be disabled as golang-ci uses it internally to detect uncompilable code.
# Unfortunately the src/azb2c package triggers this erroneously so we add it to skip-dirs below.
#
linters:
enable-all: true
disable:
- containedctx
- contextcheck
- cyclop
- deadcode
- depguard
- dupl
- dupword
- durationcheck
- errchkjson
- errname
- exhaustivestruct
- exhaustruct
- forbidigo
- forcetypeassert
# DONT re-enable funlen please
- funlen
- gci
- gochecknoglobals
- goconst
- gocritic
- gocyclo
- godot
- godox
- goerr113
- gofumpt
- golint
- gomoddirectives
- gomnd
- gosec
- gosimple
- ifshort
- inamedparam
- interfacer
- interfacebloat
- ireturn
- maligned
- maintidx
- misspell
- musttag
- nilerr
- nilnil
- nlreturn
- noctx
- nestif
- nolintlint
- nonamedreturns
- nosnakecase
- nosprintfhostport
- paralleltest
- perfsprint
- prealloc
- protogetter
- revive
- rowserrcheck
- scopelint
- structcheck
- stylecheck
- tagalign
- tagliatelle
- tenv
- testifylint
- testpackage
- thelper
- tparallel
- unparam
- unused
- usestdlibvars
- varcheck
- varnamelen
- wastedassign
- whitespace
- wsl
- wrapcheck
run:
build-tags:
- golangcilint
issues:
exclude-rules:
- text: "weak cryptographic primitive"
linters:
- gosec