-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgolangci.yml
300 lines (297 loc) · 7.49 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
linters:
disable-all: true
enable:
- asasalint
# asciicheck: unicode identifiers can help readability
- bidichk
- bodyclose
- containedctx
- contextcheck
- cyclop
# deadcode: deprecated
- decorder
# depguard: we have no dependency constraints
- dogsled
- dupl
- dupword
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
# exhaustivestruct: deprecated
# exhaustruct: harms readability
- exportloopref
- forbidigo
- forcetypeassert
- funlen
- gci
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
# godox: committing these can accelerate development
# goerr113: unnecessary in situations with adequate wrapping or where programmatic detection is not needed
- gofmt
# gofumpt: we don't use gofumpt, since it is too prescriptive
# goheader: we don't use copyright headers
- goimports
# golint: deprecated
- gomnd
- gomoddirectives
# gomodguard: we have no dependency constraints
- goprintffuncname
- gosec
- gosimple
- gosmopolitan
- govet
- grouper
# ifshort: deprecated
# importas: no aliases to act upon yet
- ineffassign
- interfacebloat
# interfacer: deprecated
- ireturn
- lll
- loggercheck
- maintidx
- makezero
# maligned: deprecated
- mirror
- misspell
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
# nonamedreturns: named returns help readability, especially with duplicated types; naked returns are the problem
# nosnakecase: deprecated
- nosprintfhostport
- paralleltest
# prealloc: authors recommend not using it due to premature optimization
- predeclared
# promlinter: we don't use Prometheus
- reassign
- revive
- rowserrcheck
# scopelint: deprecated
- sqlclosecheck
- staticcheck
# structcheck: deprecated
# stylecheck: covered by staticcheck
- tagalign
- tagliatelle
- tenv
- testableexamples
# testpackage: we want to allow comprehensive testing, and we can still do basic testing in other test files
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
# varcheck: deprecated
# varnamelen: too non-idiomatic in common cases
- wastedassign
- whitespace
- wrapcheck
# wsl: too prescriptive, gets in the way of logical line separation
# zerologlint: we don't use zerolog
linters-settings:
cyclop:
max-complexity: 25
decorder:
disable-init-func-first-check: false
errchkjson:
report-no-exported: true
exhaustive:
check:
- switch
- map
default-signifies-exhaustive: true
gocyclo:
min-complexity: 25
govet:
check-shadowing: false
grouper:
import-require-single-import: true
lll:
tab-width: 4
misspell:
locale: "US"
nakedret:
max-func-lines: 0 # Named returns are okay, but always return explicitly
nestif:
min-complexity: 6
nolintlint:
require-explanation: true
require-specific: true
revive:
rules:
# add-constant: handled by goconst
- name: argument-limit
disabled: false
arguments: [6]
- name: atomic
disabled: false
- name: bare-return
disabled: false
# banned-characters: nothing to ban
- name: blank-imports
disabled: false
- name: bool-literal-in-expr
disabled: false
- name: call-to-gc
disabled: false
- name: comment-spacings
disabled: false
- name: confusing-naming
disabled: false
- name: confusing-results
disabled: false
# cognitive-complexity: handled by gocognit
- name: constant-logical-expr
disabled: false
- name: context-as-argument
disabled: false
- name: context-keys-type
disabled: false
# cyclomatic: handled by cyclop and gocyclo
- name: datarace
disabled: false
- name: deep-exit
disabled: false
- name: defer
disabled: false
- name: dot-imports
disabled: false
- name: duplicated-imports
disabled: false
- name: early-return
disabled: false
- name: empty-block
disabled: false
# empty-lines: conflicts with whitespace multi-func option
- name: error-naming
disabled: false
- name: error-return
disabled: false
- name: error-strings
disabled: false
- name: errorf
disabled: false
- name: exported
disabled: false
# file-header: we don't use copyright headers
- name: flag-parameter
disabled: false
# function-length: handled by funlen
- name: function-result-limit
disabled: false
arguments: [5]
# get-return: Get* functions are non-idiomatic
- name: identical-branches
disabled: false
# if-return: an extra "if" usually enhances line-of-sight readability
- name: increment-decrement
disabled: false
- name: indent-error-flow
disabled: false
# imports-blacklist: we have no dependency constraints
- name: import-shadowing
disabled: false
# line-length-limit: handled by lll
# modifies-parameter: this often enhances readability
- name: modifies-value-receiver
disabled: false
- name: nested-structs
disabled: false
# optimize-operands-order: not accurate enough to be useful
- name: package-comments
disabled: false
- name: range
disabled: false
- name: range-val-in-closure
disabled: false
- name: range-val-address
disabled: false
- name: receiver-naming
disabled: false
- name: redefines-builtin-id
disabled: false
- name: string-of-int
disabled: false
- name: struct-tag
disabled: false
# string-format: not a user-facing scenario
- name: superfluous-else
disabled: false
- name: time-equal
disabled: false
- name: time-naming
disabled: false
- name: unconditional-recursion
disabled: false
- name: unexported-naming
disabled: false
- name: unexported-return
disabled: false
- name: unhandled-error
disabled: false
- name: unnecessary-stmt
disabled: false
- name: unreachable-code
disabled: false
- name: unused-parameter
disabled: false
- name: unused-receiver
disabled: false
- name: use-any
disabled: false
# useless-break: often improves readability as an explicit reminder that Go does not default fallthrough
- name: var-declaration
disabled: false
- name: var-naming
disabled: false
- name: waitgroup-by-value
disabled: false
staticcheck:
checks:
- "all"
dot-import-whitelist: []
tagalign:
align: false # tagalign not integrated into formatting toolchain
sort: true
tagliatelle:
use-field-name: true
rules:
json: goCamel
tenv:
all: true
thelper:
test:
begin: false
benchmark:
begin: false
tb:
begin: false
fuzz:
begin: false
whitespace:
multi-func: true
issues:
exclude-rules:
- path: '(.+)_test\.go'
linters:
- funlen
- wrapcheck