-
Notifications
You must be signed in to change notification settings - Fork 60
/
.golangci.yml
246 lines (242 loc) · 6.16 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
linters-settings:
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
gci:
local-prefixes: github.com/vesoft-inc
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
# https://github.com/go-critic/go-critic/blob/master/docs/overview.md#sloppyreassign
# Conflict with go vet --shadow
- sloppyReassign
gocyclo:
min-complexity: 20
goimports:
local-prefixes: github.com/vesoft-inc
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: argument,case,condition,return
govet:
check-shadowing: true
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: 140
maligned:
suggest-new: true
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
stylecheck:
checks:
- all
- '-ST1000'
- '-ST1003'
- '-ST1016'
- '-ST1020'
- '-ST1021'
- '-ST1022'
- '-ST1023'
dot-import-whitelist: []
http-status-code-whitelist: []
revive:
ignore-generated-header: true
severity: error
rules:
- name: context-keys-type
- name: time-naming
- name: var-declaration
- name: unexported-return
- name: errorf
# - name: blank-imports
- name: context-as-argument
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
# - name: exported # TODO: remove the comment exclude, and add comments
- name: if-return
- name: increment-decrement
- name: var-naming
arguments: [["ID", "SQL", "URL","RAM","RPC"],[]]
# - name: package-comments # TODO: remove the comment exclude, and add comments
- name: range
- name: receiver-naming
- name: indent-error-flow
- name: argument-limit
arguments: [5]
- name: cyclomatic
arguments: [20]
- name: max-public-structs
arguments: [20]
# - name: file-header # TODO: Add licence file header
# arguments: ["/*\nCopyright 2021 Vesoft Inc."]
- name: empty-block
- name: superfluous-else
- name: confusing-naming
# - name: get-return
- name: modifies-parameter
- name: confusing-results
- name: deep-exit
- name: unused-parameter
- name: unreachable-code
# - name: add-constant
- name: flag-parameter
- name: unnecessary-stmt
- name: struct-tag
- name: modifies-value-receiver
- name: constant-logical-expr
- name: bool-literal-in-expr
- name: redefines-builtin-id
- name: function-result-limit
arguments: [ 5 ]
- name: imports-blacklist
arguments: []
- name: range-val-in-closure
- name: range-val-address
- name: waitgroup-by-value
- name: atomic
- name: empty-lines
- name: line-length-limit
arguments: [ 140 ]
- name: call-to-gc
- name: duplicated-imports
- name: import-shadowing
- name: bare-return
- name: unused-receiver
- name: unhandled-error
arguments: ["fmt.Printf"]
- name: cognitive-complexity
arguments: [50]
- name: string-of-int
# - name: string-format
# arguments: []
- name: early-return
- name: unconditional-recursion
- name: identical-branches
- name: defer
arguments: [["call-chain","loop","method-call","recover", "return"]]
- name: unexported-naming
- name: function-length
arguments: [60, 120]
linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exportloopref
- exhaustive
# - funlen
- gochecknoinits
- goconst
- gocritic
# - gocyclo
- gofmt
# - goimports
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- noctx
- nolintlint
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- revive
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
# don't enable:
# - asciicheck
# - gomnd
# - scopelint
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - interfacer
# - maligned
# - nestif
# - prealloc
# - testpackage
# - wsl
issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd
- dupl
- revive
- gochecknoinits
- lll
- errcheck
- goconst
- path: _test\.go
text: "G404: Use of weak random number generator"
linters:
- gosec
- path: _test\.go
text: "shadow: declaration of"
linters:
- govet
- source: go:generate
text: "line is [\\d]+ characters"
linters:
- lll
- revive
- source: "// [@]?doc[s]?[ ]?:" # for docs comment
text: "line is [\\d]+ characters"
linters:
- lll
- revive
run:
skip-dirs:
- deploy
- docs
- scripts