7
7
concurrency : 4
8
8
9
9
# timeout for analysis, e.g. 30s, 5m, default is 1m
10
- timeout : 1m
10
+ timeout : 6m
11
11
12
12
# exit code when at least one issue was found, default is 1
13
13
issues-exit-code : 1
19
19
build-tags :
20
20
- mytag
21
21
22
- # which dirs to skip: issues from them won't be reported;
23
- # can use regexp here: generated.*, regexp is applied on full path;
24
- # default value is empty list, but default dirs are skipped independently
25
- # of this option's value (see skip-dirs-use-default).
26
- # "/" will be replaced by current OS file path separator to properly work
27
- # on Windows.
28
- skip-dirs :
29
- - .github
30
- - .make
31
- - dist
32
-
33
22
# default is true. Enables skipping of directories:
34
23
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
35
24
skip-dirs-use-default : true
36
25
37
- # which files to skip: they will be analyzed, but issues from them
38
- # won't be reported. Default value is empty list, but there is
39
- # no need to include all autogenerated files, we confidently recognize
40
- # autogenerated files. If it's not please let us know.
41
- # "/" will be replaced by current OS file path separator to properly work
42
- # on Windows.
43
- skip-files :
44
- - " .*\\ .my\\ .go$"
45
- - lib/bad.go
46
-
47
26
# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
48
27
# If invoked with -mod=readonly, the go command is disallowed from the implicit
49
28
# automatic updating of go.mod described above. Instead, it fails when any changes
58
37
# If false (default) - golangci-lint acquires file lock on start.
59
38
allow-parallel-runners : false
60
39
61
-
62
40
# output configuration options
63
41
output :
64
42
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
65
- format : colored-line-number
43
+ formats :
44
+ - format : colored-line-number
66
45
67
46
# print lines of code with issue, default is true
68
47
print-issued-lines : true
@@ -76,7 +55,6 @@ output:
76
55
# add a prefix to the output file references; default is no prefix
77
56
path-prefix : " "
78
57
79
-
80
58
# all available settings of specific linters
81
59
linters-settings :
82
60
dogsled :
@@ -94,10 +72,9 @@ linters-settings:
94
72
# default is false: such cases aren't reported by default.
95
73
check-blank : false
96
74
97
- # [deprecated] comma-separated list of pairs of the form pkg:regex
98
- # the regex is used to ignore names within pkg. (default "fmt:.*").
99
- # see https://github.com/kisielk/errcheck#the-deprecated-method for details
100
- ignore : fmt:.*,io/ioutil:^Read.*
75
+ # path to a file containing a list of functions to exclude from checking
76
+ # see https://github.com/kisielk/errcheck#excluding-functions for details
77
+ exclude-functions : fmt:.*,io/ioutil:^Read.*
101
78
102
79
# path to a file containing a list of functions to exclude from checking
103
80
# see https://github.com/kisielk/errcheck#excluding-functions for details
@@ -111,10 +88,8 @@ linters-settings:
111
88
lines : 60
112
89
statements : 40
113
90
gci :
114
- # put imports beginning with prefix after 3rd-party packages;
115
- # only support one prefix
116
- # if not set, use goimports.local-prefixes
117
- local-prefixes : github.com/org/project
91
+ sections :
92
+ - prefix(github.com/org/project) # Custom section: groups all imports with the specified Prefix.
118
93
gocognit :
119
94
# minimal code complexity to report, 30 by default (but we recommend 10-20)
120
95
min-complexity : 10
@@ -125,7 +100,7 @@ linters-settings:
125
100
# minimal length of string constant, 3 by default
126
101
min-len : 3
127
102
# minimal occurrences count to trigger, 3 by default
128
- min-occurrences : 3
103
+ min-occurrences : 10
129
104
gocritic :
130
105
# Which checks should be enabled; can't be combined with 'disabled-checks';
131
106
# See https://go-critic.github.io/overview#checks-overview
@@ -176,35 +151,15 @@ linters-settings:
176
151
# define here regexp type values, for example
177
152
# AUTHOR: .*@mycompany\.com
178
153
template :
179
- # put here copyright header template for source code files, for example:
180
- # {{ AUTHOR }} {{ COMPANY }} {{ YEAR }}
181
- # SPDX-License-Identifier: Apache-2.0
182
- #
183
- # Licensed under the Apache License, Version 2.0 (the "License");
184
- # you may not use this file except in compliance with the License.
185
- # You may obtain a copy of the License at:
186
- #
187
- # http://www.apache.org/licenses/LICENSE-2.0
188
- #
189
- # Unless required by applicable law or agreed to in writing, software
190
- # distributed under the License is distributed on an "AS IS" BASIS,
191
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
192
- # See the License for the specific language governing permissions and
193
- # limitations under the License.
194
- template-path :
195
- # also, as alternative of directive 'template' you may put the path to file with the template source
154
+ " "
196
155
goimports :
197
156
# put imports beginning with prefix after 3rd-party packages;
198
157
# it's a comma-separated list of prefixes
199
158
local-prefixes : github.com/org/project
200
- gomnd :
201
- settings :
202
- mnd :
203
- # the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
204
- checks : argument,case,condition,operation,return,assign
159
+ golint :
160
+ # minimal confidence for issues, default is 0.8
161
+ min-confidence : 0.8
205
162
govet :
206
- # report about shadowed variables
207
- check-shadowing : true
208
163
209
164
# settings per analyzer
210
165
settings :
@@ -218,27 +173,25 @@ linters-settings:
218
173
# enable or disable analyzers by name
219
174
enable :
220
175
- atomicalign
176
+ - shadow
221
177
enable-all : false
222
- disable :
223
- # - shadow
178
+ # disable:
179
+ # - shadow
224
180
disable-all : false
225
- depguard :
226
- list-type : blacklist
227
- include-go-root : false
228
- packages :
229
- - github.com/sirupsen/logrus
230
- packages-with-error-message :
231
- # specify an error message to output when a blacklisted package is used
232
- - github.com/sirupsen/logrus : " logging is allowed only by logutils.Log"
181
+ # depguard:
182
+ # list-type: blacklist
183
+ # include-go-root: false
184
+ # packages:
185
+ # - github.com/sirupsen/logrus
186
+ # packages-with-error-message:
187
+ # # specify an error message to output when a blacklisted package is used
188
+ # - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
233
189
lll :
234
190
# max line length, lines longer will be reported. Default is 120.
235
191
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
236
192
line-length : 120
237
193
# tab width in spaces. Default to 1.
238
194
tab-width : 1
239
- maligned :
240
- # print struct with more effective memory layout or not, false by default
241
- suggest-new : true
242
195
misspell :
243
196
# Correct spellings using locale preferences for US or UK.
244
197
# Default is to use a neutral variety of English.
@@ -263,7 +216,7 @@ linters-settings:
263
216
# Enable to ensure that nolint directives are all used. Default is true.
264
217
allow-unused : false
265
218
# Disable to ensure that nolint directives don't have a leading space. Default is true.
266
- allow-leading-space : true
219
+ # allow-leading-space: true
267
220
# Exclude following linters from requiring an explanation. Default is [].
268
221
allow-no-explanation : []
269
222
# Enable to require an explanation of nonzero length after each nolint directive. Default is false.
@@ -283,17 +236,17 @@ linters-settings:
283
236
# with golangci-lint call it on a directory with the changed file.
284
237
check-exported : false
285
238
unused :
286
- # treat code as a program (not a library) and report unused exported identifiers; default is false.
287
- # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
288
- # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
289
- # with golangci-lint call it on a directory with the changed file.
290
- check-exported : false
239
+ # treat code as a program (not a library) and report unused exported identifiers; default is false.
240
+ # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
241
+ # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
242
+ # with golangci-lint call it on a directory with the changed file.
243
+ # check-exported: false
291
244
whitespace :
292
245
multi-if : false # Enforces newlines (or comments) after every multi-line if statement
293
246
multi-func : false # Enforces newlines (or comments) after every multi-line function signature
294
247
wsl :
295
248
# If true append is only allowed to be cuddled if appending value is
296
- # matching variables, fields or types online above. Default is true.
249
+ # matching variables, fields or types on the line above. Default is true.
297
250
strict-append : true
298
251
# Allow calls and assignments to be cuddled as long as the lines have any
299
252
# matching variables, fields or types. Default is true.
@@ -329,40 +282,95 @@ linters-settings:
329
282
330
283
linters :
331
284
enable :
332
- - megacheck
285
+ - gosimple
286
+ - staticcheck
287
+ - unused
333
288
- govet
289
+ - gofmt
334
290
- gosec
335
291
- bodyclose
336
292
- revive
337
293
- unconvert
338
- - dupl
339
294
- misspell
340
295
- dogsled
341
296
- prealloc
342
297
- exportloopref
343
298
- exhaustive
344
299
- sqlclosecheck
345
300
- nolintlint
346
- - gci
347
- - goconst
301
+ - asciicheck
302
+ - bidichk
303
+ - bodyclose
304
+ - containedctx
305
+ - unused
306
+ - dogsled
307
+ - durationcheck
308
+ - errchkjson
309
+ - errname
310
+ - errorlint
311
+ - exhaustive
312
+ - forbidigo
313
+ - gocheckcompilerdirectives
314
+ - gochecknoinits
315
+ - gochecksumtype
316
+ - goheader
317
+ - gosmopolitan
318
+ - inamedparam
319
+ - makezero
320
+ - mirror
321
+ - misspell
322
+ - musttag
323
+ - nosprintfhostport
324
+ - prealloc
325
+ - predeclared
326
+ - reassign
327
+ - rowserrcheck
328
+ - sqlclosecheck
329
+ - unconvert
330
+ - wastedassign
331
+ - contextcheck
332
+ # - perfsprint - this needs more fixes to full use
333
+ # - goconst # Turned this off - tons of false positives
348
334
disable :
349
335
- gocritic # use this for very opinionated linting
350
- - gochecknoglobals
351
- - whitespace
352
- - wsl
353
- - goerr113
354
- - godot
355
- - testpackage
356
- - nestif
357
- - nlreturn
336
+ - gci # issues a lot with import sorting
337
+ - gochecknoglobals # this project uses some globals
338
+ - godot # some comments do not end in a period
339
+ - godox # finds all the HACKs
340
+ - err113 # requires a lot of fixes for errors with wrapping
341
+ - gomnd # we have too many raw numbers that are not magic
342
+ - gomoddirectives # we use replace as needed
343
+ - nilnil # we do not conform to this
344
+ # - contextcheck # having issues with this
358
345
disable-all : false
359
346
presets :
360
347
- bugs
361
348
- unused
362
349
fast : false
363
350
364
-
365
351
issues :
352
+
353
+ # which files to skip: they will be analyzed, but issues from them
354
+ # won't be reported. Default value is empty list, but there is
355
+ # no need to include all autogenerated files, we confidently recognize
356
+ # autogenerated files. If it's not please let us know.
357
+ # "/" will be replaced by current OS file path separator to properly work
358
+ # on Windows.
359
+ exclude-files :
360
+ - " .*\\ .my\\ .go$"
361
+ - lib/bad.go
362
+
363
+ # which dirs to skip: issues from them won't be reported;
364
+ # can use regexp here: generated.*, regexp is applied on full path;
365
+ # default value is empty list, but default dirs are skipped independently
366
+ # of this option's value (see skip-dirs-use-default).
367
+ # "/" will be replaced by current OS file path separator to properly work
368
+ # on Windows.
369
+ exclude-dirs :
370
+ - .github
371
+ - .make
372
+ - dist
373
+
366
374
# List of regexps of issue texts to exclude, empty list by default.
367
375
# But independently of this option we use default exclude patterns,
368
376
# it can be disabled by `exclude-use-default: false`. To list all
@@ -372,18 +380,10 @@ issues:
372
380
373
381
# Excluding configuration per-path, per-linter, per-text and per-source
374
382
exclude-rules :
375
- - linters :
376
- - gosec
377
- text : " G304:"
378
-
379
383
# Exclude some linters from running on tests files.
380
384
- path : _test\.go
381
385
linters :
382
386
- gocyclo
383
- - errcheck
384
- - dupl
385
- - gosec
386
- - goconst
387
387
388
388
# Exclude known linters from partially hard-vendored code,
389
389
# which is impossible to exclude via "nolint" comments.
@@ -397,6 +397,16 @@ issues:
397
397
- staticcheck
398
398
text : " SA1019:"
399
399
400
+ # Exclude some gosec messages
401
+ - linters :
402
+ - gosec
403
+ text : " G202:"
404
+
405
+ # Exclude some scopelint messages
406
+ - linters :
407
+ - scopelint
408
+ text : " Using the variable on range scope"
409
+
400
410
# Exclude lll issues for long lines with go:generate
401
411
- linters :
402
412
- lll
@@ -412,6 +422,10 @@ issues:
412
422
# regular expressions become case-sensitive.
413
423
exclude-case-sensitive : false
414
424
425
+ # The list of IDs of default excludes to include or disable. By default, it's empty.
426
+ include :
427
+ - EXC0002 # disable excluding of issues about comments from golint
428
+
415
429
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
416
430
max-issues-per-linter : 0
417
431
@@ -434,7 +448,7 @@ issues:
434
448
435
449
severity :
436
450
# Default value is empty string.
437
- # Set the default severity for issues. If severity rules are defined and the issues
451
+ # Set the default severity for issues. If severity rules are defined, and the issues
438
452
# do not match or no severity is provided to the rule this will be the default
439
453
# severity applied. Severities should match the supported severity names of the
440
454
# selected out format.
0 commit comments