-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yaml
More file actions
429 lines (428 loc) · 9.29 KB
/
.golangci.yaml
File metadata and controls
429 lines (428 loc) · 9.29 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
# Copyright (c) 2023 coding-hui. All rights reserved.
# Use of this source code is governed by a MIT style
# license that can be found in the LICENSE file.
version: "2"
run:
concurrency: 4
issues-exit-code: 1
tests: true
allow-parallel-runners: true
output:
path-prefix: ""
linters:
enable:
- asasalint
- asciicheck
- bidichk
- durationcheck
- errorlint
- exhaustive
- gocheckcompilerdirectives
- gochecksumtype
- goconst
- gocritic
- gocyclo
- gosec
- gosmopolitan
- loggercheck
- makezero
- misspell
- musttag
- nakedret
- nilnesserr
- protogetter
- reassign
- recvcheck
- revive
- spancheck
- testifylint
- unconvert
- zerologlint
disable:
- bodyclose
- contextcheck
- errchkjson
- nilerr
- noctx
- rowserrcheck
- sqlclosecheck
- unparam
settings:
bidichk:
left-to-right-embedding: true
right-to-left-embedding: true
pop-directional-formatting: true
left-to-right-override: true
right-to-left-override: true
left-to-right-isolate: true
right-to-left-isolate: true
first-strong-isolate: true
pop-directional-isolate: true
cyclop:
max-complexity: 50
package-average: 0
dogsled:
max-blank-identifiers: 2
dupl:
threshold: 150
errcheck:
check-type-assertions: false
check-blank: false
errorlint:
errorf: true
asserts: true
comparison: true
exhaustive:
default-signifies-exhaustive: true
ignore-enum-members: ""
package-scope-only: false
forbidigo:
forbid:
- pattern: fmt\.Print.*
- pattern: fmt.Println.*
- pattern: ginkgo\\.F.*
funlen:
lines: 150
statements: 50
gocognit:
min-complexity: 30
goconst:
match-constant: true
min-len: 3
min-occurrences: 3
numbers: false
min: 3
max: 3
ignore-calls: true
gocritic:
enabled-checks:
- truncateCmp
- unnamedResult
- ruleguard
disabled-checks:
- regexpMust
- ifElseChain
- exitAfterDefer
enabled-tags:
- performance
disabled-tags:
- experimental
gocyclo:
min-complexity: 30
godot:
scope: declarations
capital: false
godox:
keywords:
- BUG
- FIXME
- OPTIMIZE
- HACK
goheader:
# Supports two types 'const` and `regexp`.
# Values can be used recursively.
# Default: {}
values:
const:
# Define here const type values in format k:v.
# For example:
COMPANY: WECODING
regexp:
# Define here regexp type values.
# for example:
AUTHOR: .*wecoding@\.yeah\.net
template-path: hack/boilerplate.txt
gomoddirectives:
replace-allow-list:
- google.golang.org/grpc
- github.com/coding-hui/api
- github.com/coding-hui/common
- github.com/coding-hui/wecoding-sdk-go
replace-local: true
exclude-forbidden: false
retract-allow-no-explanation: false
gomodguard:
allowed:
modules:
- gorm.io/gorm
- gorm.io/driver/mysql
- k8s.io/klog
- k8s.io/klog/v2
- k8s.io/component-base
- k8s.io/apimachinery
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/coding-hui/common/errors
reason: '`github.com/coding-hui/common/errors` is the log package used by coding-hui projects.'
versions:
- github.com/MakeNowJust/heredoc:
version: '> 2.0.9'
reason: use the latest version
local-replace-directives: false
gosec:
includes:
- G401
- G306
- G101
excludes:
- G204
severity: low
confidence: low
config:
G101:
entropy_threshold: "80.0"
ignore_entropy: false
pattern: (?i)example
per_char_threshold: "3.0"
truncate: "32"
G306: "0600"
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
importas:
alias:
- pkg: knative.dev/serving/pkg/apis/serving/v1
alias: servingv1
- pkg: knative.dev/serving/pkg/apis/autoscaling/v1alpha1
alias: autoscalingv1alpha1
- pkg: knative.dev/serving/pkg/apis/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: k8s.io/component-base/cli/flag
alias: cliflag
- pkg: github.com/coding-hui/common/meta/v1
alias: metav1
no-unaliased: true
ireturn:
allow:
- anon
- error
- empty
- stdlib
- (or|er)$
reject:
- github.com\/user\/package\/v4\.Type
lll:
tab-width: 1
makezero:
always: false
misspell:
locale: US
ignore-rules:
- someword
nakedret:
max-func-lines: 30
nestif:
min-complexity: 4
nilnil:
checked-types:
- ptr
- func
- iface
- map
- chan
nlreturn:
block-size: 1
nolintlint:
require-explanation: false
require-specific: true
allow-unused: false
prealloc:
simple: true
range-loops: true
for-loops: false
predeclared:
qualified-name: false
promlinter:
strict: 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: camel
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
wrapcheck:
ignore-sigs:
- .Errorf(
- errors.New(
- errors.Unwrap(
- .Wrap(
- .Wrapf(
- .WithMessage(
- .WithMessagef(
- .WithStack(
ignore-package-globs:
- encoding/*
- github.com/pkg/*
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:
- path: _test\.go
linters:
- gocyclo
- errcheck
- dupl
- goconst
- linters:
- errorlint
path: (pkg/validator/.*)\.go
- linters:
- forbidigo
path: (cmd/.*|test/.*|tools/.*|internal/pump/pumps/.*)\.go
- linters:
- dupl
path: (cmd/[a-z]*/.*|store/.*)\.go
- linters:
- gocritic
text: (hugeParam:|rangeValCopy:)
- linters:
- tagliatelle
path: (internal/.*/options)
- linters:
- lll
source: '^//go:generate '
issues:
max-issues-per-linter: 0
max-same-issues: 0
new: false
fix: true
severity:
default: error
rules:
- linters:
- dupl
severity: info
formatters:
enable:
- gofmt
- goimports
settings:
gofmt:
simplify: true
gofumpt:
extra-rules: false
goimports:
local-prefixes:
- github.com/coding-hui/iam
exclusions:
generated: lax