forked from gofiber/fiber
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.golangci.yml
382 lines (347 loc) · 8.35 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
# v1.2.0. Created based on golangci-lint v1.56.2
run:
timeout: 5m
skip-dirs-use-default: false
modules-download-mode: readonly
allow-serial-runners: true
skip-dirs:
- internal # TODO: Do not ignore interal
output:
sort-results: true
uniq-by-line: false
linters-settings:
depguard:
rules:
all:
list-mode: lax
deny:
- pkg: "flag"
desc: '`flag` package is only allowed in main.go'
- pkg: "log"
desc: 'logging is provided by `pkg/log`'
- pkg: "io/ioutil"
desc: '`io/ioutil` package is deprecated, use the `io` and `os` package instead'
# TODO: Prevent using these without a reason
# - pkg: "reflect"
# desc: '`reflect` package is dangerous to use'
# - pkg: "unsafe"
# desc: '`unsafe` package is dangerous to use'
errcheck:
check-type-assertions: true
check-blank: true
disable-default-exclusions: true
exclude-functions:
- '(*bytes.Buffer).Write' # always returns nil error
- '(*github.com/valyala/bytebufferpool.ByteBuffer).Write' # always returns nil error
- '(*github.com/valyala/bytebufferpool.ByteBuffer).WriteByte' # always returns nil error
- '(*github.com/valyala/bytebufferpool.ByteBuffer).WriteString' # always returns nil error
errchkjson:
report-no-exported: true
exhaustive:
check-generated: true
default-signifies-exhaustive: true
forbidigo:
forbid:
- ^print(ln)?$
- ^fmt\.Print(f|ln)?$
- ^http\.Default(Client|ServeMux|Transport)$
# TODO: Eventually enable these patterns
# - ^panic$
# - ^time\.Sleep$
analyze-types: true
gci:
sections:
- standard
- prefix(github.com/gofiber/fiber)
- default
- blank
- dot
# - alias
custom-order: true
goconst:
numbers: true
gocritic:
# TODO: Uncomment the following lines
enabled-tags:
- diagnostic
# - style
# - performance
# - experimental
# - opinionated
settings:
captLocal:
paramsOnly: false
elseif:
skipBalanced: false
underef:
skipRecvDeref: false
# NOTE: Set this option to false if other projects rely on this project's code
# unnamedResult:
# checkExported: false
gofumpt:
module-path: github.com/gofiber/fiber
extra-rules: true
gosec:
excludes:
- G104 # TODO: Enable this again. Mostly provided by errcheck
config:
global:
# show-ignored: true # TODO: Enable this
audit: true
govet:
enable-all: true
disable:
- fieldalignment
- shadow
grouper:
# const-require-grouping: true # TODO: Enable this
import-require-single-import: true
import-require-grouping: true
# var-require-grouping: true # TODO: Conflicts with gofumpt
loggercheck:
require-string-key: true
no-printf-like: true
misspell:
locale: US
nolintlint:
require-explanation: true
require-specific: true
nonamedreturns:
report-error-in-defer: true
perfsprint:
err-error: true
predeclared:
q: true
promlinter:
strict: true
# TODO: Enable this
# reassign:
# patterns:
# - '.*'
revive:
enable-all-rules: true
rules:
# Provided by gomnd linter
- name: add-constant
disabled: true
- name: argument-limit
disabled: true
# Provided by bidichk
- name: banned-characters
disabled: true
- name: cognitive-complexity
disabled: true
- name: comment-spacings
arguments:
- nolint
disabled: true # TODO: Do not disable
- name: cyclomatic
disabled: true
# TODO: Enable this check. Currently disabled due to upstream bug.
# - name: enforce-repeated-arg-type-style
# arguments:
# - short
- name: enforce-slice-style
arguments:
- make
disabled: true # TODO: Do not disable
- name: exported
disabled: true
- name: file-header
disabled: true
- name: function-result-limit
arguments: [3]
- name: function-length
disabled: true
- name: line-length-limit
disabled: true
- name: max-public-structs
disabled: true
- name: modifies-parameter
disabled: true
- name: nested-structs
disabled: true # TODO: Do not disable
- name: package-comments
disabled: true
- name: optimize-operands-order
disabled: true
- name: unchecked-type-assertion
disabled: true # TODO: Do not disable
- name: unhandled-error
arguments: ['bytes\.Buffer\.Write']
stylecheck:
checks:
- all
- -ST1000
- -ST1020
- -ST1021
- -ST1022
tagalign:
strict: true
tagliatelle:
case:
rules:
json: snake
tenv:
all: true
testifylint:
enable-all: true
testpackage:
skip-regexp: "^$"
unparam:
# NOTE: Set this option to false if other projects rely on this project's code
check-exported: false
unused:
# TODO: Uncomment these two lines
# parameters-are-used: false
# local-variables-are-used: false
# NOTE: Set these options to true if other projects rely on this project's code
field-writes-are-uses: true
# exported-is-used: true # TODO: Fix issues with this option (upstream)
exported-fields-are-used: true
usestdlibvars:
http-method: true
http-status-code: true
time-weekday: false # TODO: Set to true
time-month: false # TODO: Set to true
time-layout: false # TODO: Set to 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
wrapcheck:
ignorePackageGlobs:
- github.com/gofiber/fiber/*
- github.com/valyala/fasthttp
issues:
exclude-use-default: false
exclude-case-sensitive: true
max-issues-per-linter: 0
max-same-issues: 0
exclude-rules:
- linters:
- goerr113
text: 'do not define dynamic errors, use wrapped static errors instead*'
- path: log/.*\.go
linters:
- depguard
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- bodyclose
# fix: true
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
# - cyclop
- decorder
- depguard
- dogsled
# - dupl
# - dupword # TODO: Enable
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
# - exhaustivestruct
# - exhaustruct
- exportloopref
- forbidigo
- forcetypeassert
# - funlen
# - gci # TODO: Enable
- ginkgolinter
# - gocheckcompilerdirectives # TODO: Enable
# - gochecknoglobals # TODO: Enable
# - gochecknoinits # TODO: Enable
- gochecksumtype
# - gocognit
# - goconst # TODO: Enable
- gocritic
# - gocyclo
# - godot
# - godox
- goerr113
- gofmt
- gofumpt
# - goheader
# - goimports
# - golint
# - gomnd # TODO: Enable
- gomoddirectives
# - gomodguard
- goprintffuncname
- gosec
- gosimple
# - gosmopolitan # TODO: Enable
- govet
- grouper
# - ifshort # TODO: Enable
# - importas
# - inamedparam
- ineffassign
# - interfacebloat
# - interfacer
# - ireturn
# - lll
- loggercheck
# - maintidx
- makezero
# - maligned
- mirror
- misspell
- musttag
- nakedret
# - nestif
- nilerr
- nilnil
# - nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
# - paralleltest # TODO: Enable
- perfsprint
# - prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
# - scopelint # TODO: Enable
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- stylecheck
# - tagalign # TODO: Enable
- tagliatelle
- tenv
- testableexamples
- testifylint
# - testpackage # TODO: Enable
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
# - varnamelen
# - wastedassign # TODO: Enable
- whitespace
- wrapcheck
# - wsl
- zerologlint