-
Notifications
You must be signed in to change notification settings - Fork 461
Expand file tree
/
Copy path.golangci.yml
More file actions
255 lines (255 loc) · 6.5 KB
/
Copy path.golangci.yml
File metadata and controls
255 lines (255 loc) · 6.5 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
version: "2"
run:
build-tags:
- big
- compatibility
- dtest
- integration
modules-download-mode: readonly
issues-exit-code: 1
tests: true
linters:
# NB: the v1 -> v2 migration (#4410) expanded the old `presets` blocks
# against v2's linter set, which silently pulled in checks this repo had
# never opted into. They were left disabled in that bump and re-enabled one
# per follow-up PR: copyloopvar, canonicalheader, nilnesserr, iface,
# exptostd, predeclared, intrange, prealloc, noctx, goconst.
# recvcheck is deliberately left disabled: most of what it reports is the
# value-receiver Marshal* / pointer-receiver Unmarshal* pairing that YAML and
# JSON round-tripping requires, and the rest is not worth the churn.
enable:
- asasalint
- canonicalheader
- copyloopvar
- exptostd
- goconst
- iface
- intrange
- nilnesserr
- noctx
- predeclared
- prealloc
- asciicheck
- bidichk
- decorder
- dupl
- durationcheck
- errchkjson
- errorlint
- exhaustive
- forbidigo
- ginkgolinter
- gocheckcompilerdirectives
- gochecksumtype
- gocritic
- goheader
- gomodguard_v2
- goprintffuncname
- grouper
- importas
- lll
- loggercheck
- makezero
- misspell
- nakedret
- nosprintfhostport
- reassign
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- tparallel
- unconvert
- unparam
- zerologlint
disable:
- bodyclose
- containedctx
- contextcheck
- depguard
- dogsled
- err113
- errname
- exhaustruct
- forcetypeassert
- funlen
- gochecknoglobals
- gochecknoinits
- gocyclo
- godot
- godox
- gomoddirectives
- gosec
- gosmopolitan
- inamedparam
- interfacebloat
- ireturn
- mirror
- mnd
- musttag
- nilerr
- nilnil
- nlreturn
- nolintlint
- nonamedreturns
- paralleltest
- promlinter
- protogetter
- recvcheck
- revive
- tagalign
- tagliatelle
- testifylint
- testpackage
- thelper
- usestdlibvars
- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl
settings:
depguard:
rules:
main:
deny:
- pkg: github.com/sirupsen/logrus
desc: logging is allowed only by logutils.Log
- pkg: github.com/golang/protobuf/jsonpb
desc: replace with github.com/gogo/protobuf/jsonpb
- pkg: google.golang.org/protobuf/encoding/protojson
desc: replace with github.com/gogo/protobuf/jsonpb
- pkg: github.com/golang/protobuf/proto
desc: replace with github.com/gogo/protobuf/proto
- pkg: google.golang.org/protobuf/proto
desc: replace with github.com/gogo/protobuf/proto
- pkg: github.com/tj/assert
desc: use github.com/stretchr/testify/assert
dupl:
threshold: 100
exhaustive:
default-signifies-exhaustive: true
goconst:
min-len: 3
min-occurrences: 3
# Count occurrences in non-test code only; test fixtures repeat
# literals freely and would otherwise push production strings over
# the threshold.
ignore-tests: true
# Boolean and sentinel words are not meaningful constants.
ignore-string-values:
- ^(true|false|unknown|none)$
gocritic:
disabled-checks:
- hugeParam
- rangeValCopy
- ifElseChain
enabled-tags:
- performance
settings:
captLocal:
paramsOnly: true
govet:
enable:
- shadow
disable:
# new analyzer, did not run under v1.56
- inline
lll:
line-length: 120
tab-width: 1
misspell:
locale: US
ignore-rules:
- someword
nakedret:
max-func-lines: 30
prealloc:
simple: true
range-loops: true
for-loops: false
staticcheck:
checks:
- all
- -SA1019
# stylecheck was merged into staticcheck in v2 but is disabled above;
# QF is a new family. Neither ran under v1.56.
- -ST*
- -QF*
unparam:
check-exported: false
exclusions:
generated: lax
rules:
- linters:
- lll
source: '^//go:generate '
- path: (.+)\.go$
text: Using the variable on range scope `tt` in function literal
- path: (.+)\.go$
text: Using the variable on range scope `test` in function literal
- path: (.+)\.go$
text: 'shadow: declaration of "err" shadows declaration'
- path: (.+)\.go$
text: Profiling endpoint is automatically exposed on /debug/pprof
- path: (.+)\.go$
text: 'Blacklisted import `crypto/md5`: weak cryptographic primitive'
- path: (.+)\.go$
text: Error return value of `\(github.com\/go-kit\/kit\/log.Logger\).Log` is not checked
- path: (.+)\.go$
text: Error return value of `[a-zA-Z.]+.Body.Close` is not checked
- path: (.+)\.go$
text: 'G104: Errors unhandled'
- path: (.+)\.go$
text: 'G404: Use of weak random number generator (math/rand instead of crypto/rand)'
- path: (.+)\.go$
text: 'G103: Use of unsafe calls should be audited'
# net.Listen / net.Dial only take a context via ListenConfig / Dialer,
# and none of the call sites have one to pass: the replacement would be
# (&net.ListenConfig{}).Listen(context.Background(), ...), which is
# exactly what net.Listen already does. Keep the plain calls.
- linters:
- noctx
text: '^net\.(Listen|Dial|DialTimeout) must not be called'
- linters:
- goconst
- noctx
- prealloc
path: (.+)_test\.go
# Test fixtures and harnesses that live in non-_test.go files.
- linters:
- goconst
path: (^|/)(integration|stub|test)/
paths:
- .*_gen.go$
- .*\.peg\.go$
- generated/.*
- eventlog/test$
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
new-from-rev: 30e1c10d456af9d3778288cfb7c247ecd06a4339
formatters:
enable:
- gci
- gofmt
- goimports
settings:
gci:
sections:
- standard
- prefix(github.com/m3db/m3)
- default
exclusions:
generated: lax
paths:
- .*_gen.go$
- .*\.peg\.go$
- generated/.*
- eventlog/test$
- third_party$
- builtin$
- examples$