-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy path.golangci.yml
More file actions
268 lines (246 loc) · 6.66 KB
/
Copy path.golangci.yml
File metadata and controls
268 lines (246 loc) · 6.66 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
version: "2"
# run `golangci-lint run --config .golangci.yml` to check changes
issues:
# maximum number of issues to print per linter (0 means unlimited)
max-issues-per-linter: 0
# maximum number of issues with the same text to print
max-same-issues: 0
linters:
default: standard ## 'none|standard|all'; enable
disable:
- errcheck
- gosec
- wsl
- wsl_v5
enable:
- asciicheck
- bodyclose
- canonicalheader
- copyloopvar
- depguard
- dogsled
- dupl
- dupword
- durationcheck
# errcheck
- errorlint ## excluding "wrapped errors"
# exhaustive ## TODO: "missing cases in switch of type"
- fatcontext
- gochecksumtype
- gocritic
- goheader
- gomoddirectives
- goprintffuncname
# gosec
- govet
- importas
- ineffassign
- intrange
# modernize ## TODO: slicesbackward vs `config verify`
- musttag
- misspell
- nakedret
- nilnesserr
- noctx
- nolintlint
- perfsprint
- prealloc
- protogetter
- reassign
- revive
- staticcheck
- testpackage
- unconvert
- unparam
- unused
- usetesting
- wastedassign
- whitespace
# containedctx ## ("found a struct that contains a context.Context field")
# ginkgolinter ## (TODO: use it to cleanup unit tests)
# recvcheck ## (config below)
# See: https://golangci-lint.run/usage/linters/
settings:
dupl:
threshold: 100
revive:
# ignore-generated-header: true
severity: warning
rules:
# name: import-shadowing
# name: time-naming
# name: unhandled-error
# name: var-naming
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: early-return
- name: error-naming
- name: error-strings
- name: if-return
- name: increment-decrement
- name: indent-error-flow
- name: modifies-value-receiver
- name: range
- name: receiver-naming
- name: redefines-builtin-id
- name: string-of-int
- name: superfluous-else
- name: time-date
- name: var-declaration
- name: unconditional-recursion
- name: unexported-naming
- name: unexported-return
- name: unnecessary-format
- name: unnecessary-stmt
- name: unreachable-code
- name: unused-parameter
- name: unused-receiver
- name: use-fmt-print
- name: waitgroup-by-value
errcheck:
check-type-assertions: true
check-blank: true
disable-default-exclusions: false
# exclude-functions:
# io/ioutil.ReadFile
# io.Copy(*bytes.Buffer)
# io.Copy(os.Stdout)
govet:
enable-all: true
disable:
- fieldalignment ## (fieldalignment -fix path)
- shadow ## ditto
gocritic:
enabled-tags:
- performance
- style
disabled-checks:
- unnamedResult
- unnecessaryBlock
- importShadow ## TODO (wtp)
gosec:
excludes: ## integer overflow; weak rand
- G115
- G402
- G404
prealloc:
simple: true # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: true # Report preallocation suggestions on for loops, false by default
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US
recvcheck:
disable-builtin: true
# The format is `struct_name.method_name` (ex: `Foo.MethodName`).
# A wildcard `*` can use as a struct name (ex: `*.MethodName`).
exclusions:
- "*.UnmarshalJSON"
- "*.UnmarshalYAML"
modernize:
# By default, all analyzers are enabled.
disable:
- omitzero
- stringscut
depguard:
rules:
main:
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: 'math/rand$'
desc: "`math/rand` package has been deprecated use `math/rand/v2`"
# Defines a set of rules to ignore issues.
# It does not skip the analysis, and so does not ignore "typecheck" errors.
exclusions:
warn-unused: false ## TODO (e.g., warn skipped [Path: "tools/", Linters: "nakedret"])
# Predefined exclusion rules.
# Default: []
presets:
# comments
# std-error-handling
# common-false-positives
- legacy
# Excluding configuration per-path, per-linter, per-text and per-source.
rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- errcheck
- dupl
- gosec
- nakedret
- noctx
- govet
- modernize
- prealloc
- nolintlint
- path: _gen\.go
linters:
- nakedret
- dupl
- gocritic
- govet
- goimports
- path: bench/
linters:
- nakedret
- noctx
- modernize
- path: tools/
linters:
- nakedret
- noctx
- govet
- modernize
- prealloc
- path: ext/dsort/
linters:
- unused
# Exclude certain staticcheck warnings, e.g.: "remove embedded field DemandBase", "Deprecated" - TODO remove
- linters:
- staticcheck
text: "QF1008:"
- linters:
- staticcheck
text: "SA1019:"
# Exclude errorlint "wrapped errors. Use errors.Is" and "non-wrapping format ... Use `%w` to format error"
- linters:
- errorlint
text: "wrapped errors"
- linters:
- errorlint
text: "non-wrapping format"
formatters:
enable:
- gofmt
- goimports
settings:
gofmt:
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'
goimports:
local-prefixes:
- github.com/NVIDIA/aistore
# exclusions:
# paths:
# test/testdata
run:
go: '1.26'
tests: true # Enable linting test files.
concurrency: 8
timeout: 8m
# NOTE: these are the default build tags for the linter;
# use `TAGS=... make lint` to check that the corresponding alternative sources do lint correctly;
# e.g. `TAGS=aws make lint`
build-tags:
- hrw
- aws
- azure
- gcp
- oci
# - nethttp