-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
273 lines (272 loc) · 7.9 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
270
271
272
273
linters:
# Disable all linters.
# Default: false
disable-all: false
# Enable specific linter
# https://golangci-lint.run/usage/linters/#enabled-by-default
enable:
- exhaustive
- exhaustruct
- bodyclose
- asciicheck
- asasalint
- bidichk
- contextcheck
- decorder
- dogsled
- dupl
- dupword
- durationcheck
- errchkjson
- errname
- exportloopref
#- forcetypeassert
- funlen
- goconst
- gocritic
- godot
- godox
- gofmt
- mnd
- gosec
- gosmopolitan
- importas
- interfacebloat
- lll
- makezero
- mirror
- misspell
- musttag
- nestif
- nilerr # TODO: is this good?
- nilnil # TODO: is this good?
- noctx
- prealloc
- predeclared
- reassign
- revive
- rowserrcheck
- sqlclosecheck
- tagalign
- tagliatelle
- unconvert
- unparam
- usestdlibvars
- whitespace
#- wrapcheck
linters-settings:
exhaustive:
# Program elements to check for exhaustiveness.
# Default: [ switch ]
check:
- switch
- map
# Check switch statements in generated files also.
# Default: false
check-generated: true
# Presence of "default" case in switch statements satisfies exhaustiveness,
# even if all enum members are not listed.
# Default: false
default-signifies-exhaustive: false
# Enum members matching the supplied regex do not have to be listed in
# switch statements to satisfy exhaustiveness.
# Default: ""
#ignore-enum-members: "Example.+"
# Enum types matching the supplied regex do not have to be listed in
# switch statements to satisfy exhaustiveness.
# Default: ""
#ignore-enum-types: "Example.+"
# Consider enums only in package scopes, not in inner scopes.
# Default: false
package-scope-only: true
# Only run exhaustive check on switches with "//exhaustive:enforce" comment.
# Default: false
explicit-exhaustive-switch: false
# Only run exhaustive check on map literals with "//exhaustive:enforce" comment.
# Default: false
explicit-exhaustive-map: true
# Switch statement requires default case even if exhaustive.
# Default: false
default-case-required: false
exhaustruct:
# List of regular expressions to match struct packages and their names.
# Regular expressions must match complete canonical struct package/name/structname.
# If this list is empty, all structs are tested.
# Default: []
include:
#- '.+\.Test'
#- 'example\.com/package\.ExampleStruct[\d]{1,2}'
# List of regular expressions to exclude struct packages and their names from checks.
# Regular expressions must match complete canonical struct package/name/structname.
# Default: []
exclude:
- '.+/errors\.Span$'
decorder:
# Required order of `type`, `const`, `var` and `func` declarations inside a file.
# Default: types before constants before variables before functions.
dec-order:
- const
- var
- type
- func
dupl:
# Tokens count to trigger issue.
# Default: 150
threshold: 100
goconst:
# Minimal length of string constant.
# Default: 3
min-len: 1
# Minimum occurrences of constant string count to trigger issue.
# Default: 3
min-occurrences: 2
# Ignore test files.
# Default: false
ignore-tests: false
# Look for existing constants matching the values.
# Default: true
match-constant: true
# Search also for duplicated numbers.
# Default: false
numbers: true
# Minimum value, only works with goconst.numbers
# Default: 3
min: 2
# Maximum value, only works with goconst.numbers
# Default: 3
max: 2
# Ignore when constant is not used as function argument.
# Default: true
ignore-calls: false
# Exclude strings matching the given regular expression.
# Default: ""
# Is ignored due to panics in switch-blocks
ignore-strings: 'A new .* was added without updating this code'
godot:
# Comments to be checked: `declarations`, `toplevel`, or `all`.
# Default: declarations
scope: all
# List of regexps for excluding particular comment lines from check.
# Default: []
exclude:
# Exclude certain comments
- "^BUG:"
- "^TODO:"
# Check that each sentence ends with a period.
# Default: true
period: true
# Check that each sentence starts with a capital letter.
# Default: false
capital: true
godox:
# Report any comments starting with keywords, this is useful for TODO or FIXME comments that
# might be left in the code accidentally and should be resolved before merging.
# Default: ["TODO", "BUG", "FIXME"]
keywords:
- TODO
- BUG
- HACK
- FIXME
- NOTE
inamedparam:
# Skips check for interface methods with only a single parameter.
# Default: false
skip-single-param: false
lll:
# Max line length, lines longer will be reported.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option.
# Default: 120.
line-length: 120
# Tab width in spaces.
# Default: 1
tab-width: 4
misspell:
# Correct spellings using locale preferences for US or UK.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
# Default is to use a neutral variety of English.
locale: US
# Default: []
#ignore-words:
#- someword
# Mode of the analysis:
# - default: checks all the file content.
# - restricted: checks only comments.
# Default: ""
mode: default
nestif:
# Minimal complexity of if statements to report.
# Default: 5
min-complexity: 3
nilnil:
# Checks that there is no simultaneous return of `nil` error and an invalid value.
# Default: ["ptr", "func", "iface", "map", "chan"]
checked-types:
- ptr
- func
- iface
- map
- chan
nlreturn:
# Size of the block (including return statement that is still "OK")
# so no return split required.
# Default: 1
block-size: 1
usestdlibvars:
# Suggest the use of http.MethodXX.
# Default: true
http-method: true
# Suggest the use of http.StatusXX.
# Default: true
http-status-code: true
# Suggest the use of time.Weekday.String().
# Default: true
time-weekday: true
# Suggest the use of time.Month.String().
# Default: false
time-month: true
# Suggest the use of time.Layout.
# Default: false
time-layout: true
# Suggest the use of crypto.Hash.String().
# Default: false
crypto-hash: true
# Suggest the use of rpc.DefaultXXPath.
# Default: false
default-rpc-path: true
# DEPRECATED Suggest the use of os.DevNull.
# Default: false
os-dev-null: true
# Suggest the use of sql.LevelXX.String().
# Default: false
sql-isolation-level: true
# Suggest the use of tls.SignatureScheme.String().
# Default: false
tls-signature-scheme: true
# Suggest the use of constant.Kind.String().
# Default: false
constant-kind: true
# DEPRECATED Suggest the use of syslog.Priority.
# Default: false
syslog-priority: true
unused:
# Mark all struct fields that have been written to as used.
# Default: true
field-writes-are-uses: true
# Treat IncDec statement (e.g. `i++` or `i--`) as both read and write operation instead of just write.
# Default: false
post-statements-are-reads: true
# Mark all exported identifiers as used.
# Default: true
exported-is-used: true
# Mark all exported fields as used.
# default: true
exported-fields-are-used: true
# Mark all function parameters as used.
# default: true
parameters-are-used: true
# Mark all local variables as used.
# default: true
local-variables-are-used: true
# Mark all identifiers inside generated files as used.
# Default: true
generated-is-used: true