1
1
2
- # options for analysis running
3
2
run :
4
- # timeout for analysis, e.g. 30s, 5m, default is 1m
5
- deadline : 5m
6
-
7
- # exit code when at least one issue was found, default is 1
3
+ go : " 1.22.11 "
4
+ concurrency : 4
5
+ timeout : 5m
6
+ tests : false
8
7
issues-exit-code : 1
9
-
10
- # include test files or not, default is true
11
- tests : true
12
-
13
- # which files to skip: they will be analyzed, but issues from them
14
- # won't be reported. Default value is empty list, but there is
15
- # no need to include all autogenerated files, we confidently recognize
16
- # autogenerated files. If it's not please let us know.
17
- skip-files :
18
- - easyjson
8
+ modules-download-mode : readonly
19
9
20
10
issues :
21
- # Independently from option 'exclude' we use default exclude patterns,
22
- # it can be disabled by this option. To list all
23
- # excluded by default patterns execute 'golangci-lint run --help'.
24
- # Default value for this option is true.
25
11
exclude-use-default : false
26
- # Excluding configuration per-path, per-linter, per-text and per-source
27
- exclude-rules :
28
- # Exclude some linters from running on tests files.
29
- - path : _test\.go
30
- linters :
31
- - prealloc
32
- - errcheck
12
+ max-issues- per-linter: 100
13
+ max-same-issues : 4
14
+ new : false
15
+ exclude-files :
16
+ - " .+_test.go "
17
+ exclude-dirs :
18
+ - " vendor$ "
33
19
34
- # output configuration options
35
20
output :
36
- # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
37
- format : colored-line-number
21
+ formats :
22
+ - format : line-number
23
+ sort-results : true
38
24
39
- # print lines of code with issue, default is true
40
- print-issued-lines : true
41
-
42
- # print linter name in the end of issue text, default is true
43
- print-linter-name : true
44
-
45
- # all available settings of specific linters
46
25
linters-settings :
47
26
govet :
48
- # report about shadowed variables
49
27
check-shadowing : true
50
- enable :
51
- # report mismatches between assembly files and Go declarations
52
- - asmdecl
53
- # check for useless assignments
54
- - assign
55
- # check for common mistakes using the sync/atomic package
56
- - atomic
57
- # check for non-64-bits-aligned arguments to sync/atomic functions
58
- - atomicalign
59
- # check for common mistakes involving boolean operators
60
- - bools
61
- # check that +build tags are well-formed and correctly located
62
- - buildtag
63
- # detect some violations of the cgo pointer passing rules
64
- - cgocall
65
- # check for unkeyed composite literals
66
- - composites
67
- # check for locks erroneously passed by value
68
- - copylocks
69
- # check for calls of reflect.DeepEqual on error values
70
- - deepequalerrors
71
- # report passing non-pointer or non-error values to errors.As
72
- - errorsas
73
- # find calls to a particular function
74
- - findcall
75
- # report assembly that clobbers the frame pointer before saving it
76
- - framepointer
77
- # check for mistakes using HTTP responses
78
- - httpresponse
79
- # detect impossible interface-to-interface type assertions
80
- - ifaceassert
81
- # check references to loop variables from within nested functions
82
- - loopclosure
83
- # check cancel func returned by context.WithCancel is called
84
- - lostcancel
85
- # check for useless comparisons between functions and nil
86
- - nilfunc
87
- # check for redundant or impossible nil comparisons
88
- - nilness
89
- # check consistency of Printf format strings and arguments
90
- - printf
91
- # check for comparing reflect.Value values with == or reflect.DeepEqual
92
- - reflectvaluecompare
93
- # check for possible unintended shadowing of variables
94
- - shadow
95
- # check for shifts that equal or exceed the width of the integer
96
- - shift
97
- # check for unbuffered channel of os.Signal
98
- - sigchanyzer
99
- # check the argument type of sort.Slice
100
- - sortslice
101
- # check signature of methods of well-known interfaces
102
- - stdmethods
103
- # check for string(int) conversions
104
- - stringintconv
105
- # check that struct field tags conform to reflect.StructTag.Get
106
- - structtag
107
- # report calls to (*testing.T).Fatal from goroutines started by a test.
108
- - testinggoroutine
109
- # check for common mistaken usages of tests and examples
110
- - tests
111
- # report passing non-pointer or non-interface values to unmarshal
112
- - unmarshal
113
- # check for unreachable code
114
- - unreachable
115
- # check for invalid conversions of uintptr to unsafe.Pointer
116
- - unsafeptr
117
- # check for unused results of calls to some functions
118
- - unusedresult
119
- # checks for unused writes
120
- - unusedwrite
121
- disable :
122
- # find structs that would use less memory if their fields were sorted
123
- - fieldalignment
28
+ enable :
29
+ - asmdecl
30
+ - assign
31
+ - atomic
32
+ - atomicalign
33
+ - bools
34
+ - buildtag
35
+ - cgocall
36
+ - composites
37
+ - copylocks
38
+ - deepequalerrors
39
+ - errorsas
40
+ - findcall
41
+ - framepointer
42
+ - httpresponse
43
+ - ifaceassert
44
+ - loopclosure
45
+ - lostcancel
46
+ - nilfunc
47
+ - nilness
48
+ - printf
49
+ - reflectvaluecompare
50
+ - shadow
51
+ - shift
52
+ - sigchanyzer
53
+ - sortslice
54
+ - stdmethods
55
+ - stringintconv
56
+ - structtag
57
+ - testinggoroutine
58
+ - tests
59
+ - unmarshal
60
+ - unreachable
61
+ - unsafeptr
62
+ - unusedresult
63
+ - unusedwrite
64
+ disable :
65
+ - fieldalignment
124
66
gofmt :
125
- # simplify code: gofmt with '-s' option, true by default
126
67
simplify : true
127
68
errcheck :
128
- # report about not checking of errors in type assetions: 'a := b.(MyStruct)';
129
- # default is false: such cases aren't reported by default.
130
69
check-type-assertions : true
131
- # report about assignment of errors to blank identifier: 'num, _ := strconv.Atoi(numStr)';
132
- # default is false: such cases aren't reported by default.
133
70
check-blank : true
134
71
gocyclo :
135
- # minimal code complexity to report, 30 by default (but we recommend 10-20)
136
- min-complexity : 15
72
+ min-complexity : 30
137
73
misspell :
138
- # Correct spellings using locale preferences for US or UK.
139
- # Default is to use a neutral variety of English.
140
- # Setting locale to US will correct the British spelling of 'colour' to 'color'.
141
74
locale : US
142
75
prealloc :
143
- # XXX: we don't recommend using this linter before doing performance profiling.
144
- # For most programs usage of prealloc will be a premature optimization.
145
- # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
146
- # True by default.
147
76
simple : true
148
- range-loops : true # Report preallocation suggestions on range loops, true by default
149
- for-loops : true # Report preallocation suggestions on for loops, false by default
77
+ range-loops : true
78
+ for-loops : true
150
79
unparam :
151
- # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
152
- # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
153
- # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
154
- # with golangci-lint call it on a directory with the changed file.
155
80
check-exported : false
156
81
gci :
157
- # Section configuration to compare against.
158
- # Section names are case-insensitive and may contain parameters in ().
159
- # The default order of sections is 'standard > default > custom > blank > dot',
160
- # If 'custom-order' is 'true', it follows the order of 'sections' option.
161
- # Default: ["standard", "default"]
162
- # sections:
163
- # - standard # Standard section: captures all standard packages.
164
- # - default # Default section: contains all imports that could not be matched to another section type.
165
- # - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
166
- # - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
167
- # Skip generated files.
168
- # Default: true
169
82
skip-generated : true
170
- # Enable custom order of sections.
171
- # If 'true', make the section order the same as the order of 'sections'.
172
- # Default: false
173
83
custom-order : false
174
84
gosec :
175
- # To select a subset of rules to run.
176
- # Available rules: https://github.com/securego/gosec#available-rules
177
- # Default: [] - means include all rules
178
85
includes :
179
86
- G101 # Look for hard coded credentials
180
87
- G102 # Bind to all interfaces
@@ -210,9 +117,6 @@ linters-settings:
210
117
- G504 # Import blocklist: net/http/cgi
211
118
- G505 # Import blocklist: crypto/sha1
212
119
- G601 # Implicit memory aliasing of items from a range statement
213
- # To specify a set of rules to explicitly exclude.
214
- # Available rules: https://github.com/securego/gosec#available-rules
215
- # Default: []
216
120
excludes :
217
121
- G101 # Look for hard coded credentials
218
122
- G102 # Bind to all interfaces
@@ -248,104 +152,39 @@ linters-settings:
248
152
- G504 # Import blocklist: net/http/cgi
249
153
- G505 # Import blocklist: crypto/sha1
250
154
- G601 # Implicit memory aliasing of items from a range statement
251
- # Exclude generated files
252
- # Default: false
253
155
exclude-generated : true
254
- # Filter out the issues with a lower severity than the given value.
255
- # Valid options are: low, medium, high.
256
- # Default: low
257
156
severity : medium
258
- # Filter out the issues with a lower confidence than the given value.
259
- # Valid options are: low, medium, high.
260
- # Default: low
261
157
confidence : medium
262
- # Concurrency value.
263
- # Default: the number of logical CPUs usable by the current process.
264
158
concurrency : 12
265
- # To specify the configuration of rules.
266
159
config :
267
- # Globals are applicable to all rules.
268
160
global :
269
- # If true, ignore #nosec in comments (and an alternative as well).
270
- # Default: false
271
161
nosec : true
272
- # Add an alternative comment prefix to #nosec (both will work at the same time).
273
- # Default: ""
274
162
" #nosec " : " #my-custom-nosec"
275
- # Define whether nosec issues are counted as finding or not.
276
- # Default: false
277
163
show-ignored : true
278
- # Audit mode enables addition checks that for normal code analysis might be too nosy.
279
- # Default: false
280
164
audit : true
281
165
G101 :
282
- # Regexp pattern for variables and constants to find.
283
- # Default: "(?i)passwd|pass|password|pwd|secret|token|pw|apiKey|bearer|cred"
284
- pattern : " (?i)example"
285
- # If true, complain about all cases (even with low entropy).
286
- # Default: false
166
+ pattern : " (?i)passwd|pass|password|pwd|secret|token|pw|apiKey|bearer|cred"
287
167
ignore_entropy : false
288
- # Maximum allowed entropy of the string.
289
- # Default: "80.0"
290
168
entropy_threshold : " 80.0"
291
- # Maximum allowed value of entropy/string length.
292
- # Is taken into account if entropy >= entropy_threshold/2.
293
- # Default: "3.0"
294
169
per_char_threshold : " 3.0"
295
- # Calculate entropy for first N chars of the string.
296
- # Default: "16"
297
170
truncate : " 32"
298
- # Additional functions to ignore while checking unhandled errors.
299
- # Following functions always ignored:
300
- # bytes.Buffer:
301
- # - Write
302
- # - WriteByte
303
- # - WriteRune
304
- # - WriteString
305
- # fmt:
306
- # - Print
307
- # - Printf
308
- # - Println
309
- # - Fprint
310
- # - Fprintf
311
- # - Fprintln
312
- # strings.Builder:
313
- # - Write
314
- # - WriteByte
315
- # - WriteRune
316
- # - WriteString
317
- # io.PipeWriter:
318
- # - CloseWithError
319
- # hash.Hash:
320
- # - Write
321
- # os:
322
- # - Unsetenv
323
- # Default: {}
324
171
G104 :
325
172
fmt :
326
173
- Fscanf
327
174
G111 :
328
- # Regexp pattern to find potential directory traversal.
329
- # Default: "http\\.Dir\\(\"\\/\"\\)|http\\.Dir\\('\\/'\\)"
330
- pattern : " custom\\ .Dir\\ (\\ )"
331
- # Maximum allowed permissions mode for os.Mkdir and os.MkdirAll
332
- # Default: "0750"
175
+ pattern : " http\\ .Dir\\ (\"\\ /\"\\ )|http\\ .Dir\\ ('\\ /'\\ )"
333
176
G301 : " 0750"
334
- # Maximum allowed permissions mode for os.OpenFile and os.Chmod
335
- # Default: "0600"
336
177
G302 : " 0600"
337
- # Maximum allowed permissions mode for os.WriteFile and ioutil.WriteFile
338
- # Default: "0600"
339
178
G306 : " 0600"
340
179
341
180
lll :
342
- # Max line length, lines longer will be reported.
343
- # '\t' is counted as 1 character by default, and can be changed with the tab-width option.
344
- # Default: 120.
345
- line-length : 120
346
- # Tab width in spaces.
347
- # Default: 1
181
+ line-length : 130
348
182
tab-width : 1
183
+ staticcheck :
184
+ go : " 1.15"
185
+ # SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
186
+ # Default: ["*"]
187
+ checks : [ "*", "-SA1019" ]
349
188
350
189
linters :
351
190
disable-all : true
@@ -357,7 +196,6 @@ linters:
357
196
- gocyclo
358
197
- ineffassign
359
198
- goimports
360
- - nakedret
361
199
- unparam
362
200
- unused
363
201
- prealloc
0 commit comments