-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.golangci.yaml
311 lines (302 loc) · 10 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
linters:
# linters: https://golangci-lint.run/usage/linters/
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
- cyclop
- decorder
# - depguard # Go linter that checks if package imports are in a list of acceptable packages. Not needed for most projects.
- dogsled
- dupl
- dupword
- durationcheck
# - err113 # conflicts with errorlint
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
# - exhaustruct # conflicts with empty struct initialization
- fatcontext
- forbidigo
- forcetypeassert
- funlen
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
- gochecksumtype
- gocognit
- goconst
- gocritic
- gocyclo
# - godot
- godox
- gofmt
- gofumpt
- goheader
- goimports
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- gosmopolitan
- govet
- grouper
- importas
- inamedparam
- ineffassign
- interfacebloat
- intrange
- ireturn
- lll
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
# - paralleltest # using parallel tests can introduce a lot of concurrency issues. Add it when you can, but this should not be enforced.
- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- stylecheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- testifylint
# - testpackage # separate test package causes issues with unexported functions
- thelper
- tparallel
- unconvert
- unparam
- unused
- usestdlibvars
- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl
- zerologlint
# Enable only fast linters from enabled linters set (first run won't be fast)
# Default: false
fast: false
linters-settings:
cyclop:
# The maximal code complexity to report.
# Default: 10
max-complexity: 10
# The maximal average package complexity.
# If it's higher than 0.0 (float) the check is enabled
# Default: 0.0
package-average: 0.5
# Should ignore tests.
# Default: false
skip-tests: true
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: true
# 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
funlen:
# Checks the number of lines in a function.
# If lower than 0, disable the check.
# Default: 60
lines: 80
# Checks the number of statements in a function.
# If lower than 0, disable the check.
# Default: 40
statements: 40
# Ignore comments when counting lines.
# Default false
ignore-comments: true
varnamelen:
# The longest distance, in source lines, that is being considered a "small scope".
# Variables used in at most this many lines will be ignored.
# Default: 5
max-distance: 5
# The minimum length of a variable's name that is considered "long".
# Variable names that are at least this long will be ignored.
# Default: 3
min-name-length: 3
# Check method receivers.
# Default: false
check-receiver: false
# Check named return values.
# Default: false
check-return: false
# Check type parameters.
# Default: false
check-type-param: false
# Ignore "ok" variables that hold the bool return value of a type assertion.
# Default: false
ignore-type-assert-ok: true
# Ignore "ok" variables that hold the bool return value of a map index.
# Default: false
ignore-map-index-ok: true
# Ignore "ok" variables that hold the bool return value of a channel receive.
# Default: false
ignore-chan-recv-ok: true
# Optional list of variable names that should be ignored completely.
# Default: []
ignore-names:
- err
- tc
- k
- v
# Optional list of variable declarations that should be ignored completely.
# Entries must be in one of the following forms (see below for examples):
# - for variables, parameters, named return values, method receivers, or type parameters:
# <name> <type> (<type> can also be a pointer/slice/map/chan/...)
# - for constants: const <name>
#
# Default: []
ignore-decls:
- ctx echo.Context
- t testing.T
- f *foo.Bar
- i int
- const C
- T any
- m map[string]int
- w io.Writer
- w http.ResponseWriter
- r *http.Request
- ok bool
- wg sync.WaitGroup
- wg *sync.WaitGroup
- wg *errgroup.Group
- wg errgroup.Group
nlreturn:
# Size of the block (including return statement that is still "OK")
# so no return split required.
# Default: 1
block-size: 2
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`,
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
# Skip generated files.
# Default: true
skip-generated: true
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
custom-order: true
# Drops lexical ordering for custom sections.
# Default: false
no-lex-order: false
lll:
# Max line length, lines longer will be reported.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option.
# Default: 120.
line-length: 120
# Tab width in spaces.
# Default: 1
tab-width: 4
wsl:
# Do strict checking when assigning from append (x = append(x, y)).
# If this is set to true - the append call must append either a variable
# assigned, called or used on the line above.
# https://github.com/bombsimon/wsl/blob/master/doc/configuration.md#strict-append
# Default: true
strict-append: true
# Allows assignments to be cuddled with variables used in calls on
# line above and calls to be cuddled with assignments of variables
# used in call on line above.
# https://github.com/bombsimon/wsl/blob/master/doc/configuration.md#allow-assign-and-call
# Default: true
allow-assign-and-call: true
# Allows assignments to be cuddled with anything.
# https://github.com/bombsimon/wsl/blob/master/doc/configuration.md#allow-assign-and-anything
# Default: false
allow-assign-and-anything: false
# Allows cuddling to assignments even if they span over multiple lines.
# https://github.com/bombsimon/wsl/blob/master/doc/configuration.md#allow-multiline-assign
# Default: true
allow-multiline-assign: true
# If the number of lines in a case block is equal to or lager than this number,
# the case *must* end white a newline.
# https://github.com/bombsimon/wsl/blob/master/doc/configuration.md#force-case-trailing-whitespace
# Default: 0
force-case-trailing-whitespace: 3
# Allow blocks to end with comments.
# https://github.com/bombsimon/wsl/blob/master/doc/configuration.md#allow-trailing-comment
# Default: false
allow-trailing-comment: false
# Allow multiple comments in the beginning of a block separated with newline.
# https://github.com/bombsimon/wsl/blob/master/doc/configuration.md#allow-separated-leading-comment
# Default: false
allow-separated-leading-comment: false
# Allow multiple var/declaration statements to be cuddled.
# https://github.com/bombsimon/wsl/blob/master/doc/configuration.md#allow-cuddle-declarations
# Default: false
allow-cuddle-declarations: false
# A list of call idents that everything can be cuddled with.
# Defaults: [ "Lock", "RLock" ]
allow-cuddle-with-calls: [ "Lock", "RLock" ]
# AllowCuddleWithRHS is a list of right hand side variables that is allowed
# to be cuddled with anything.
# Defaults: [ "Unlock", "RUnlock" ]
allow-cuddle-with-rhs: [ "Unlock", "RUnlock" ]
# Causes an error when an If statement that checks an error variable doesn't
# cuddle with the assignment of that variable.
# https://github.com/bombsimon/wsl/blob/master/doc/configuration.md#force-err-cuddling
# Default: false
force-err-cuddling: false
# When force-err-cuddling is enabled this is a list of names
# used for error variables to check for in the conditional.
# Default: [ "err" ]
error-variable-names: [ "err" ]
# Causes an error if a short declaration (:=) cuddles with anything other than
# another short declaration.
# This logic overrides force-err-cuddling among others.
# https://github.com/bombsimon/wsl/blob/master/doc/configuration.md#force-short-decl-cuddling
# Default: false
force-short-decl-cuddling: false