Repository navigation
Expand file tree
/
Copy path.golangci.yaml
More file actions
490 lines (489 loc) · 12.4 KB
/
Copy path.golangci.yaml
File metadata and controls
490 lines (489 loc) · 12.4 KB
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
version: "2"
run:
concurrency: 4
build-tags:
- mytag
issues-exit-code: 1
tests: true
allow-parallel-runners: true
output:
path-prefix: ""
linters:
default: none
enable:
- asciicheck
- bodyclose
- cyclop
- depguard
- dogsled
- dupl
- durationcheck
- errcheck
- errorlint
- exhaustive
- forbidigo
- funlen
- gochecknoinits
- gocognit
- goconst
- gocyclo
- godot
- godox
- goheader
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- govet
- importas
- ineffassign
- lll
- makezero
- misspell
- nakedret
- nestif
- nilerr
- nlreturn
- noctx
- nolintlint
- paralleltest
- prealloc
- predeclared
- promlinter
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
- thelper
- tparallel
- unconvert
- unparam
- unused
- wastedassign
- whitespace
settings:
cyclop:
max-complexity: 50
package-average: 0
dogsled:
max-blank-identifiers: 2
dupl:
threshold: 100
errcheck:
check-type-assertions: false
check-blank: false
errorlint:
errorf: true
exhaustive:
default-signifies-exhaustive: false
forbidigo:
forbid:
- pattern: fmt.Println.*
- pattern: ginkgo\\.F.*
importas:
# Do not allow unaliased imports of aliased packages.
# Default: false
no-unaliased: true
# Do not allow non-required aliases.
# Default: false
no-extra-aliases: true
# List of aliases
# Default: []
alias:
- alias: "v1"
pkg: "github.com/ClessLi/bifrost/api/bifrost/v1"
- alias: "pbv1"
pkg: "github.com/ClessLi/bifrost/api/protobuf-spec/bifrostpb/v1"
- alias: "txpv1"
pkg: "github.com/ClessLi/bifrost/internal/bifrost/transport/v1"
- alias: "handlerv1"
pkg: "github.com/ClessLi/bifrost/internal/bifrost/transport/v1/handler"
- alias: "epv1"
pkg: "github.com/ClessLi/bifrost/internal/bifrost/endpoint/v1"
- alias: "svcv1"
pkg: "github.com/ClessLi/bifrost/internal/bifrost/service/v1"
- alias: "storev1"
pkg: "github.com/ClessLi/bifrost/internal/bifrost/store/v1"
- alias: "storev1nginx"
pkg: "github.com/ClessLi/bifrost/internal/bifrost/store/v1/nginx"
- alias: "txpclient"
pkg: "github.com/ClessLi/bifrost/pkg/client/bifrost/v1/transport"
- alias: "epclient"
pkg: "github.com/ClessLi/bifrost/pkg/client/bifrost/v1/endpoint"
- alias: "svcclient"
pkg: "github.com/ClessLi/bifrost/pkg/client/bifrost/v1/service"
- alias: "healthzclientv1"
pkg: "github.com/ClessLi/bifrost/pkg/client/grpc_health_v1"
- alias: "genericoptions"
pkg: "github.com/ClessLi/bifrost/internal/pkg/options"
- alias: "genericgrpcserver"
pkg: "github.com/ClessLi/bifrost/internal/pkg/server"
- alias: "grpctransport"
pkg: "github.com/go-kit/kit/transport/grpc"
- alias: "utilsV3"
pkg: "github.com/ClessLi/bifrost/pkg/resolv/V3/nginx/configuration/utils"
- alias: "utilsV2"
pkg: "github.com/ClessLi/bifrost/pkg/resolv/V2/utils"
- alias: "logV1"
pkg: "github.com/ClessLi/component-base/pkg/log/v1"
- alias: "cliflag"
pkg: "github.com/marmotedu/component-base/pkg/cli/flag"
- alias: "kitzaplog"
pkg: "github.com/go-kit/kit/log/zap"
- alias: "kitlog"
pkg: "github.com/go-kit/kit/log"
- alias: "uuid"
pkg: "github.com/satori/go.uuid"
# using `jwt` alias for `github.com/appleboy/gin-jwt/v2` package
- alias: "jwt"
pkg: "github.com/appleboy/gin-jwt/v2"
funlen:
lines: 150
statements: 50
gocognit:
min-complexity: 30
goconst:
min-len: 3
min-occurrences: 3
gocritic:
enabled-checks:
- nestingreduce
- truncatecmp
- unnamedresult
- ruleguard
disabled-checks:
- regexpMust
- ifElseChain
enabled-tags:
- performance
disabled-tags:
- experimental
settings:
captLocal:
paramsOnly: true
elseif:
skipBalanced: true
hugeParam:
sizeThreshold: 80
nestingReduce:
bodyWidth: 5
rangeExprCopy:
sizeThreshold: 512
skipTestFuncs: true
rangeValCopy:
sizeThreshold: 32
skipTestFuncs: true
ruleguard:
rules: ""
truncateCmp:
skipArchDependent: true
underef:
skipRecvDeref: true
unnamedResult:
checkExported: true
gocyclo:
min-complexity: 30
godot:
scope: declarations
capital: false
godox:
keywords:
- BUG
- FIXME
- OPTIMIZE
- HACK
goheader:
values:
const: { }
regexp: { }
gomoddirectives:
replace-allow-list:
- google.golang.org/grpc
- github.com/ClessLi/component-base
- github.com/ClessLi/skirnir
replace-local: true
exclude-forbidden: false
retract-allow-no-explanation: false
gomodguard:
allowed:
modules:
- gorm.io/gorm
- gorm.io/driver/mysql
- k8s.io/klog
domains:
- google.golang.org
- gopkg.in
- golang.org
- github.com
- go.uber.org
- go.etcd.io
blocked:
modules:
- github.com/pkg/errors:
recommendations:
- github.com/ClessLi/component-base/pkg/errors
reason: '`github.com/ClessLi/component-base/pkg/errors` is the errors package used by component-base projects.'
versions:
- github.com/MakeNowJust/heredoc:
version: '> 2.0.9'
reason: use the latest version
local-replace-directives: false
govet:
enable:
- atomicalign
disable:
- shadow
enable-all: false
disable-all: false
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 240
tab-width: 4
depguard:
rules:
main:
list-mode: original
deny:
- pkg: "math/rand$"
desc: "use math/rand/v2"
- pkg: "github.com/Sirupsen/logrus"
desc: "logging is allowed only by logutils.Log"
- pkg: "github.com/pkg/errors"
desc: "Should be replaced by standard lib errors package"
makezero:
always: false
misspell:
locale: US
ignore-rules:
- someword
nakedret:
max-func-lines: 30
nestif:
min-complexity: 5
nolintlint:
require-explanation: false
require-specific: true
allow-unused: true
prealloc:
simple: true
range-loops: true
for-loops: false
predeclared:
qualified-name: false
revive:
severity: warning
rules:
- name: indent-error-flow
severity: warning
rowserrcheck:
packages:
- github.com/jmoiron/sqlx
staticcheck:
checks:
- all
- -ST1000
- -ST1003
- -ST1016
- -ST1020
- -ST1021
- -ST1022
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
dot-import-whitelist:
- fmt
http-status-code-whitelist:
- "200"
- "400"
- "404"
- "500"
tagliatelle:
case:
rules:
avro: snake
bson: camel
json: kebab
mapstructure: kebab
xml: camel
yaml: camel
use-field-name: true
testpackage:
skip-regexp: (id|export|internal)_test\.go
thelper:
test:
first: true
name: true
begin: true
benchmark:
first: true
name: true
begin: true
tb:
first: true
name: true
begin: true
unparam:
check-exported: false
whitespace:
multi-if: false
multi-func: false
wsl:
strict-append: true
allow-assign-and-call: true
allow-assign-and-anything: false
allow-multiline-assign: true
force-case-trailing-whitespace: 0
allow-trailing-comment: false
allow-separated-leading-comment: false
allow-cuddle-declarations: false
force-err-cuddling: false
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- revive
path: (log/.*)\.go
- linters:
- wrapcheck
path: (cmd/.*|pkg/.*)\.go
- linters:
- forbidigo
path: (cmd/.*|test/.*|tools/.*)\.go
- linters:
- dupl
path: (cmd/[a-z]*/.*|store/.*)\.go
- linters:
- gocritic
text: (hugeParam:|rangeValCopy:)
- linters:
- lll
path: (cmd/[a-z]*/.*)\.go
- linters:
- gochecknoinits
path: (validator/.*|code/.*|validator/.*)
- linters:
- deadcode
- forbidigo
- unused
- varcheck
path: (pkg/app/.*)\.go
- linters:
- staticcheck
text: 'SA9003:'
- linters:
- lll
source: '^//go:generate '
- path: (.+)\.go$
text: tools/.*
- path: (.+)\.go$
text: test/.*
- path: (.+)\.go$
text: third_party/.*
paths:
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
new: false
fix: true
severity:
default: error
rules:
- linters:
- dupl
severity: info
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
settings:
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.
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
- prefix(github.com/ClessLi) # Custom section: groups all imports with the specified Prefix.
- 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.
# Checks that no inline comments are present.
# Default: false
no-inline-comments: true
# Checks that no prefix comments (comment lines above an import) are present.
# Default: false
no-prefix-comments: 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: true
gofmt:
simplify: true
gofumpt:
extra-rules: false
goimports:
local-prefixes:
- github.com/ClessLi/bifrost
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$