-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy path.golangci.yml
269 lines (266 loc) · 8.62 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# Copyright (C) 2024, Ava Labs, Inc. All rights reserved.
# See the file LICENSE for licensing terms.
# https://golangci-lint.run/usage/configuration/
version: "2"
run:
timeout: 10m
# If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
#
# Allowed values: readonly|vendor|mod
# By default, it isn't set.
modules-download-mode: readonly
linters:
default: none
enable:
- asciicheck
- bodyclose
- copyloopvar
- depguard
- dupword
- errcheck
- errorlint
- forbidigo
- goconst
- gocritic
- goprintffuncname
- gosec
- govet
- importas
- ineffassign
- misspell
- nakedret
- nilerr
- noctx
- nolintlint
- perfsprint
- prealloc
- predeclared
- revive
- spancheck
- staticcheck
- tagalign
- testifylint
- unconvert
- unparam
- unused
- usestdlibvars
- whitespace
settings:
depguard:
rules:
packages:
deny:
- pkg: container/list
desc: github.com/ava-labs/avalanchego/utils/linked should be used instead.
- pkg: github.com/stretchr/testify/assert
desc: github.com/stretchr/testify/require should be used instead.
- pkg: io/ioutil
desc: io/ioutil is deprecated. Use package io or os instead.
errorlint:
# Check for plain type assertions and type switches.
asserts: false
# Check for plain error comparisons.
comparison: false
forbidigo:
# Forbid the following identifiers (list of regexp).
forbid:
- pattern: require\.Error$(# ErrorIs should be used instead)?
- pattern: require\.ErrorContains$(# ErrorIs should be used instead)?
- pattern: require\.EqualValues$(# Equal should be used instead)?
- pattern: require\.NotEqualValues$(# NotEqual should be used instead)?
- pattern: ^(t|b|tb|f)\.(Fatal|Fatalf|Error|Errorf)$(# the require library should be used instead)?
gosec:
excludes:
- G107 # Url provided to HTTP request as taint input https://securego.io/docs/rules/g107
- G115 # TODO Enable this ruleset in a follow-up PR
importas:
alias:
- pkg: github.com/ava-labs/avalanchego/utils/math
alias: safemath
- pkg: github.com/ava-labs/avalanchego/utils
alias: avautils
- pkg: github.com/ava-labs/avalanchego/trace
alias: avatrace
- pkg: github.com/ava-labs/avalanchego/api/metrics
alias: avametrics
- pkg: github.com/ava-labs/avalanchego/cache
alias: avacache
- pkg: github.com/ava-labs/avalanchego/x/sync
alias: avasync
# Do not allow unaliased imports of aliased packages.
no-unaliased: false
# Do not allow non-required aliases.
no-extra-aliases: false
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
- name: bool-literal-in-expr
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return
- name: early-return
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines
- name: empty-lines
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format
- name: string-format
arguments:
- - b.Logf[0]
- /.*%.*/
- no format directive, use b.Log instead
- - fmt.Errorf[0]
- /.*%.*/
- no format directive, use errors.New instead
- - fmt.Fprintf[1]
- /.*%.*/
- no format directive, use fmt.Fprint instead
- - fmt.Printf[0]
- /.*%.*/
- no format directive, use fmt.Print instead
- - fmt.Sprintf[0]
- /.*%.*/
- no format directive, use fmt.Sprint instead
- - log.Fatalf[0]
- /.*%.*/
- no format directive, use log.Fatal instead
- - log.Printf[0]
- /.*%.*/
- no format directive, use log.Print instead
- - t.Logf[0]
- /.*%.*/
- no format directive, use t.Log instead
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag
- name: struct-tag
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming
- name: unexported-naming
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error
- name: unhandled-error
arguments:
- fmt\.Fprint
- fmt\.Fprintf
- fmt\.Fprintln
- fmt\.Print
- fmt\.Printf
- fmt\.Println
- math/rand\.Read
- strings\.Builder\.WriteString
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver
- name: unused-receiver
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break
- name: useless-break
disabled: false
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#exported
- name: exported
disabled: false
arguments:
- "checkPublicInterface"
- "sayRepetitiveInsteadOfStutters"
exclude:
- "**/abi/**/*.go"
- "**/api/**/*.go"
- "**/auth/**/*.go"
- "**/chain/**/*.go"
- "**/chainindex/**/*.go"
- "**/cli/**/*.go"
- "**/cmd/**/*.go"
- "**/codec/**/*.go"
- "**/consts/**/*.go"
- "**/crypto/**/*.go"
- "**/event/**/*.go"
- "**/examples/**/*.go"
- "**/extension/**/*.go"
- "**/fees/**/*.go"
- "**/genesis/**/*.go"
- "**/internal/**/*.go"
- "**/keys/**/*.go"
- "**/load/**/*.go"
- "**/proto/**/*.go"
- "**/pubsub/**/*.go"
- "**/requester/**/*.go"
- "**/state/**/*.go"
- "**/statesync/**/*.go"
- "**/storage/**/*.go"
- "**/tests/**/*.go"
- "**/throughput/**/*.go"
- "**/utils/**/*.go"
- "**/vm/**/*.go"
- "**/x/**/*.go"
- "TEST"
spancheck:
checks:
- end
staticcheck:
# https://staticcheck.io/docs/options#checks
checks:
- all
- -SA1019 # Using a deprecated function, variable, constant or field
- -SA6002 # Storing non-pointer values in sync.Pool allocates memory
- -QF1008 # Omit embedded fields from selector expression
tagalign:
align: true
sort: true
order:
- serialize
strict: true
testifylint:
# Enable all checkers (https://github.com/Antonboom/testifylint#checkers).
# Default: false
enable-all: true
disable:
- go-require
- float-compare
- equal-values
exclusions:
generated: lax
presets:
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- staticcheck
text: "(ST1000|ST1020|ST1021|ST1022)"
issues:
# Maximum issues count per one linter.
# Set to 0 to disable.
# Default: 50
max-issues-per-linter: 0
# Maximum count of issues with the same text.
# Set to 0 to disable.
# Default: 3
max-same-issues: 0
# Make issues output unique by line.
# Default: true
uniq-by-line: false
formatters:
enable:
- gci
- gofmt
- gofumpt
settings:
gci:
sections:
- standard
- default
- blank
- dot
- prefix(github.com/ava-labs/hypersdk)
- alias
custom-order: true
exclusions:
generated: lax