Repository navigation
Expand file tree
/
Copy path.golangci.yml
More file actions
365 lines (365 loc) · 10.9 KB
/
Copy path.golangci.yml
File metadata and controls
365 lines (365 loc) · 10.9 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
version: "2"
issues:
# Cached issues load in map order; these caps would then keep a random subset per run.
max-issues-per-linter: 0
max-same-issues: 0
uniq-by-line: false
run:
allow-parallel-runners: true
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- durationcheck
- fatcontext
- forbidigo
- gochecksumtype
- gocritic
- gosmopolitan
- modernize
- nilnesserr
- prealloc
- reassign
- govet
- makezero
- errchkjson
- noctx
- errorlint
- unused
- testifylint
- nosprintfhostport
- gocheckcompilerdirectives
- gosec
- usetesting
- loggercheck
- wastedassign
- revive
- gomoddirectives
disable:
- contextcheck
- err113
- exhaustive
- musttag
- nilerr
- protogetter
- recvcheck
- unparam
- wrapcheck
- sqlclosecheck # we don't use SQL
- rowserrcheck # we don't use SQL
- zerologlint # not don't use Zerolog
- spancheck # we don't use OpenTelemetry
- unconvert # not enough profit from always enabling
settings:
forbidigo:
analyze-types: true
forbid:
- pattern: '^runtime\.ReadMemStats$'
pkg: '^runtime$'
msg: runtime.ReadMemStats stops the Go runtime. Use dbg.MemUsage or runtime/metrics.
gomoddirectives:
replace-allow-list:
- github.com/holiman/bloomfilter/v2
- github.com/libp2p/go-libp2p-pubsub
revive:
rules:
- name: atomic
- name: inefficient-map-lookup
- name: string-of-int
- name: time-date
- name: time-equal
- name: unconditional-recursion
- name: useless-fallthrough
- name: waitgroup-by-value
- name: unreachable-code
- name: defer
arguments:
- ["immediate-recover", "return"]
loggercheck:
rules:
- (github.com/erigontech/erigon/common/log/v3.Logger).Trace
- github.com/erigontech/erigon/common/log/v3.Trace
- (github.com/erigontech/erigon/common/log/v3.Logger).Debug
- github.com/erigontech/erigon/common/log/v3.Debug
- (github.com/erigontech/erigon/common/log/v3.Logger).Info
- github.com/erigontech/erigon/common/log/v3.Info
- (github.com/erigontech/erigon/common/log/v3.Logger).Warn
- github.com/erigontech/erigon/common/log/v3.Warn
- (github.com/erigontech/erigon/common/log/v3.Logger).Error
- github.com/erigontech/erigon/common/log/v3.Error
- (github.com/erigontech/erigon/common/log/v3.Logger).Crit
- github.com/erigontech/erigon/common/log/v3.Crit
- (github.com/erigontech/erigon/common/log/v3.Logger).Log
- github.com/erigontech/erigon/common/log/v3.Log
- (github.com/erigontech/erigon/common/log/v3.Logger).New
- github.com/erigontech/erigon/common/log/v3.New
gosec:
includes:
- G102
- G106
- G107
- G108
- G109
- G110
- G111
- G112
- G113
- G114
- G117
- G119
- G120
- G121
- G123
- G124
- G203
- G303
- G305
- G307
- G402
- G403
- G405
- G408
- G502
- G503
- G504
- G506
- G701
- G702
- G704
- G706
- G707
- G708
- G709
- G710
usetesting:
os-mkdir-temp: false
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-checks:
- ruleguard
disabled-checks:
- commentFormatting # disabled to avoid unnecessary friction on local lints and CI for minor whitespace changes without functional benefit
- commentedOutCode # disabled to avoid false positives on doc examples, EIP spec comments, and JSON templates
enabled-tags:
- performance
- diagnostic
settings:
hugeParam:
sizeThreshold: 1000
rangeExprCopy:
sizeThreshold: 512
skipTestFuncs: true
ruleguard:
rules: rules.go
underef:
skipRecvDeref: true
testifylint:
disable-all: true
enable:
- error-is-as
- go-require
- formatter
- useless-assert
- suite-broken-parallel
- suite-method-signature
- suite-subtest-run
- nil-compare
modernize:
# newexpr wants //go:fix inline on common.NewUint64 (391 call sites) — its own PR.
disable:
- newexpr
staticcheck:
# The only place staticcheck checks are turned off. A text: exclusion runs
# the check and drops its output, which is how the SA/S1 gap this list
# replaces went unnoticed. SA1019 waits on 42 deprecations; the rest are
# golangci's own default-off ST plus the ST/QF we find too noisy.
checks:
- all
- -SA1019
- -QF1001
- -QF1002
- -QF1003
- -QF1006
- -QF1007
- -QF1008
- -QF1010
- -QF1011
- -QF1012
- -ST1000
- -ST1003
- -ST1008
- -ST1020
- -ST1021
- -ST1022
- -ST1023
- -ST1029
- -ST5011
govet:
enable-all: true
disable:
- deepequalerrors
- fieldalignment
- reflectvaluecompare
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- std-error-handling
rules:
- linters:
- forbidigo
path: '_test\.go$'
text: 'runtime\.ReadMemStats'
- linters:
- modernize
path: _grpc\.pb\.go
# errcheck v2.15+ flags bare channel receives of error types (e.g. <-errCh) as
# unchecked errors. These are intentional drains to wait for channel closure.
- linters:
- errcheck
text: "^Error return value is not checked"
source: "^\\s*(case\\s+)?<-"
# shadow is gated only under these dirs; the rest of the tree is not swept yet.
- linters:
- govet
text: "^shadow:"
path-except: "^(db|common|diagnostics|internal|node|plugins|txnprovider)/"
# Bootstrap exclusion: files with baseline shadow findings, migrated one
# file per PR. Remove a file from the list once it is clean; a file that is
# not listed is gated, so a fixed file cannot silently regress.
- linters:
- govet
text: "^shadow:"
path: "^(\
db/datastruct/btindex/bpstree_bench_test\\.go\
|db/datastruct/btindex/btree_index_test\\.go\
|db/datastruct/btindex/interp_varlen_test\\.go\
|db/datastruct/btindex/testhelpers_test\\.go\
|db/datastruct/fusefilter/fusefilter_fuzz_test\\.go\
|db/datastruct/fusefilter/fusefilter_realfile_test\\.go\
|db/datastruct/fusefilter/fusefilter_writer\\.go\
|db/datastruct/fusefilter/fusefilter_writer_test\\.go\
|db/downloader/chaintoml\\.go\
|db/downloader/downloader\\.go\
|db/downloader/downloader_test\\.go\
|db/downloader/webseed\\.go\
|db/integrity/commitment_integrity\\.go\
|db/integrity/no_gaps_in_canonical_headers\\.go\
|db/integrity/receipts_no_duplicates\\.go\
|db/kv/backup/backup\\.go\
|db/kv/backup/datadir\\.go\
|db/kv/kvcache/cache\\.go\
|db/kv/mdbx/kv_abstract_test\\.go\
|db/kv/mdbx/kv_mdbx\\.go\
|db/kv/mdbx/kv_mdbx_test\\.go\
|db/kv/membatchwithdb/memory_mutation\\.go\
|db/kv/membatchwithdb/memory_mutation_test\\.go\
|db/kv/membatchwithdb/memory_store_test\\.go\
|db/kv/prune/prune\\.go\
|db/kv/prune/prune_test\\.go\
|db/kv/rawdbv3/txnum\\.go\
|db/kv/rawdbv3/txnum_bench_test\\.go\
|db/kv/remotedbserver/remotedbserver_test\\.go\
|db/kv/temporal/kv_temporal_resources_test\\.go\
|db/kv/temporal/kv_temporal_test\\.go\
|db/rawdb/accessors_chain\\.go\
|db/rawdb/accessors_chain_test\\.go\
|db/rawdb/accessors_indexes_test\\.go\
|db/recsplit/eliasfano32/elias_fano\\.go\
|db/recsplit/eliasfano32/elias_fano_test\\.go\
|db/recsplit/index\\.go\
|db/recsplit/index_test\\.go\
|db/recsplit/recsplit\\.go\
|db/recsplit/recsplit_fuzz_test\\.go\
|db/snapshotsync/freezeblocks/beacon_block_reader\\.go\
|db/snapshotsync/freezeblocks/block_reader\\.go\
|db/snapshotsync/freezeblocks/block_reader_bench_test\\.go\
|db/snapshotsync/freezeblocks/block_snapshots\\.go\
|db/snapshotsync/freezeblocks/caplin_snapshots\\.go\
|db/snapshotsync/merger\\.go\
|db/snapshotsync/snapshots\\.go\
|db/snapshotsync/snapshotsync\\.go\
|db/snaptype/type\\.go\
|db/state/aggregator\\.go\
|db/state/aggregator_bench_test\\.go\
|db/state/aggregator_fuzz_test\\.go\
|db/state/aggregator_test\\.go\
|db/state/commitment_convert\\.go\
|db/state/commitment_version_testutil_test\\.go\
|db/state/domain\\.go\
|db/state/domain_committed\\.go\
|db/state/domain_test\\.go\
|db/state/erigondb_settings\\.go\
|db/state/execctx/domain_shared\\.go\
|db/state/execctx/domain_shared_test\\.go\
|db/state/execctx/statecache_readfill_test\\.go\
|db/state/history\\.go\
|db/state/history_test\\.go\
|db/state/inverted_index\\.go\
|db/state/inverted_index_test\\.go\
|db/state/merge\\.go\
|db/state/merge_test\\.go\
|db/state/snap_creation_fragility_test\\.go\
|db/state/squeeze\\.go\
|db/state/squeeze_test\\.go\
|db/state/stats/agg_log_stats\\.go\
|db/state/temporal_mem_batch\\.go\
|db/test/aggregator_ext_test\\.go\
|db/test/domain_shared_bench_test\\.go\
|db/test/domains_restart_test\\.go\
|db/test/lifecycle_bench_test\\.go\
|node/eth/backend\\.go\
|txnprovider/txpool/pool\\.go\
)$"
- linters:
- gosec
- perfsprint
- unused
- prealloc
path: test\.go
- linters:
- gocritic
- gosec
- unused
path: hack\.go
- linters:
- gocritic
- gosec
- unused
path: cmd/devp2p
- linters:
- gocritic
- gosec
path: metrics/sample\.go
- linters:
- gocritic
- gosec
path: p2p/dnsdisc
paths:
- build/
- vendor/
- third_party$
- builtin$
- examples$
- testdata
formatters:
enable:
- gofmt
- gofumpt
settings:
gofmt:
simplify: false
exclusions:
generated: lax
paths:
- build/
- vendor/
- third_party$
- builtin$
- examples$
- testdata