-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
246 lines (246 loc) · 6.08 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
run:
timeout: 3m
linters:
enable:
- misspell
- stylecheck
- gocritic
- unparam
- unconvert
- whitespace
- makezero
- gosec
- bodyclose
- testifylint
- gofmt
- revive
- errcheck
- copyloopvar
- goimports
- depguard
- asasalint
- asciicheck
- bidichk
- durationcheck
- gocheckcompilerdirectives
- gochecksumtype
- makezero
- protogetter
- reassign
- intrange
linters-settings:
gocritic:
# Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty
disabled-checks:
- regexpMust
- appendAssign
- exitAfterDefer
- ifElseChain
gosec:
# To specify a set of rules to explicitly exclude.
# Available rules: https://github.com/securego/gosec#available-rules
excludes:
- G402
- G404
# TODO: enable G115 after fixing the issues
- G115
testifylint:
enable:
- blank-import
- bool-compare
- compares
- empty
- error-is-as
- error-nil
- expected-actual
- formatter
- len
- negative-positive
- require-error
- suite-dont-use-pkg
- suite-extra-assert-call
- suite-subtest-run
- useless-assert
disable:
- float-compare
- go-require
gofmt:
# https://golangci-lint.run/usage/linters/#gofmt
# disable for faster check
simplify: false
rewrite-rules:
- pattern: "interface{}"
replacement: "any"
revive:
ignore-generated-header: false
severity: error
confidence: 0.8
rules:
- name: atomic
severity: warning
exclude: [""]
disabled: false
- name: blank-imports
severity: warning
exclude: [""]
disabled: false
- name: confusing-naming
severity: warning
disabled: false
exclude: [""]
- name: confusing-results
severity: warning
disabled: false
exclude: [""]
- name: context-as-argument
severity: warning
disabled: false
exclude: [""]
arguments:
- allowTypesBefore: "*testing.T,*github.com/user/repo/testing.Harness"
- name: datarace
severity: warning
disabled: false
exclude: [""]
- name: defer
severity: warning
disabled: false
exclude: [""]
arguments:
- ["call-chain", "loop"]
- name: dot-imports
severity: warning
disabled: false
exclude: [""]
- name: duplicated-imports
severity: warning
disabled: false
exclude: [""]
- name: empty-block
severity: warning
disabled: false
exclude: [""]
- name: empty-lines
severity: warning
disabled: false
exclude: [""]
- name: error-return
severity: warning
disabled: false
exclude: [""]
- name: error-strings
severity: warning
disabled: false
exclude: [""]
- name: error-naming
severity: warning
disabled: false
exclude: [""]
- name: exported
severity: warning
disabled: false
exclude: [""]
arguments:
- "checkPrivateReceivers"
- "sayRepetitiveInsteadOfStutters"
- name: identical-branches
severity: warning
disabled: false
exclude: [""]
- name: if-return
severity: warning
disabled: false
exclude: [""]
- name: modifies-parameter
severity: warning
disabled: false
exclude: [""]
- name: optimize-operands-order
severity: warning
disabled: false
exclude: [""]
- name: package-comments
severity: warning
disabled: false
exclude: [""]
- name: range
severity: warning
disabled: false
exclude: [""]
- name: range-val-in-closure
severity: warning
disabled: false
exclude: [""]
- name: range-val-address
severity: warning
disabled: false
exclude: [""]
- name: receiver-naming
severity: warning
disabled: false
exclude: [""]
- name: indent-error-flow
severity: warning
disabled: false
exclude: [""]
- name: superfluous-else
severity: warning
disabled: false
exclude: [""]
- name: unnecessary-stmt
severity: warning
disabled: false
exclude: [""]
- name: unreachable-code
severity: warning
disabled: false
exclude: [""]
- name: unused-parameter
severity: warning
disabled: false
exclude: [""]
arguments:
- allowRegex: "^_"
- name: unused-receiver
severity: warning
disabled: false
exclude: [""]
- name: useless-break
severity: warning
disabled: false
exclude: [""]
- name: var-naming
severity: warning
disabled: false
exclude: [""]
- name: waitgroup-by-value
severity: warning
disabled: false
exclude: [""]
errcheck:
exclude-functions:
- (*github.com/unrolled/render.Render).JSON
- (*github.com/unrolled/render.Render).Data
- (*github.com/unrolled/render.Render).Text
- (net/http.ResponseWriter).Write
- github.com/pingcap/log.Sync
- (github.com/tikv/pd/pkg/ratelimit.Runner).RunTask
depguard:
rules:
denied-deps:
deny:
- pkg: go.uber.org/atomic
desc: "Use 'sync/atomic' instead of 'go.uber.org/atomic'"
- pkg: github.com/pkg/errors
desc: "Use 'github.com/pingcap/errors' instead of 'github.com/pkg/errors'"
issues:
exclude-rules:
- path: (_test\.go|pkg/mock/.*\.go|tests/.*\.go)
linters:
- errcheck
# following path will enable in the future
- path: (pd-analysis|pd-api-bench|pd-backup|pd-ctl|pd-heartbeat-bench|pd-recover|pd-simulator|pd-tso-bench|pd-ut|regions-dump|stores-dump)
linters:
- errcheck
include:
- EXC0012