-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy path.golangci.yml
More file actions
282 lines (279 loc) · 11.8 KB
/
Copy path.golangci.yml
File metadata and controls
282 lines (279 loc) · 11.8 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
version: "2"
run:
concurrency: 4
issues-exit-code: 1
tests: false
allow-parallel-runners: true
linters:
enable:
- asciicheck
- bodyclose
- dogsled
- godox
- lll
- misspell
- nakedret
- noctx
- predeclared
- unconvert
- whitespace
- staticcheck
settings:
errcheck:
check-type-assertions: false
check-blank: true
exclude-functions:
- fmt.Fprint
- fmt.Fprintf
- fmt.Fprintln
funlen:
lines: 60
statements: 40
gocognit:
min-complexity: 10
goconst:
min-len: 3
min-occurrences: 3
gocritic:
disabled-checks:
- regexpMust
enabled-tags:
- performance
disabled-tags:
- experimental
settings:
captLocal:
paramsOnly: true
rangeValCopy:
sizeThreshold: 32
gocyclo:
min-complexity: 10
godox:
keywords:
- FIXME
- BUG
- XXX
govet:
enable:
- atomicalign
disable:
- shadow
enable-all: false
disable-all: false
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 190
tab-width: 1
nakedret:
max-func-lines: 30
nestif:
min-complexity: 4
testpackage:
skip-regexp: (export|internal)_test\.go
whitespace:
multi-if: false
multi-func: false
wsl:
strict-append: true
allow-assign-and-call: true
allow-multiline-assign: true
force-case-trailing-whitespace: 0
allow-trailing-comment: true
allow-separated-leading-comment: false
allow-cuddle-declarations: false
force-err-cuddling: false
predeclared:
ignore:
- len
- max
- min
staticcheck:
checks:
# SA - Static Analysis
- SA1000 # Invalid regular expression
- SA1001 # Invalid template
- SA1002 # Invalid format in 'time.Parse'
- SA1003 # Unsupported argument to functions in 'encoding/binary'
- SA1004 # Suspiciously small untyped constant in 'time.Sleep'
- SA1005 # Invalid first argument to 'exec.Command'
- SA1006 # 'Printf' with dynamic first argument and no further arguments
- SA1007 # Invalid URL in 'net/url.Parse'
- SA1008 # Non-canonical key in 'http.Header' map
- SA1010 # '(*regexp.Regexp).FindAll' called with 'n == 0'
- SA1011 # Various methods in the "strings" package expect valid UTF-8
- SA1012 # A nil 'context.Context' is being passed to a function
- SA1013 # 'io.Seeker.Seek' is being called with the whence constant as the first argument
- SA1014 # Non-pointer value passed to 'Unmarshal' or 'Decode'
- SA1015 # Using 'time.Tick' in a way that will leak
- SA1016 # Trapping a signal that cannot be trapped
- SA1017 # Channels used with 'os/signal.Notify' should be buffered
- SA1018 # 'strings.Replace' called with 'n == 0'
- SA1019 # Using a deprecated function, variable, constant or field
- SA1020 # Using an invalid host:port pair with a 'net.Listen'-related function
- SA1021 # Using 'bytes.Equal' to compare two 'net.IP'
- SA1023 # Modifying the buffer in an 'io.Writer' implementation
- SA1024 # A string cutset contains duplicate characters
- SA1025 # It is not possible to use '(*time.Timer).Reset''s return value correctly
- SA1026 # Cannot marshal channels or functions
- SA1027 # Atomic access to 64-bit variable must be 64-bit aligned
- SA1028 # 'sort.Slice' can only be used on slices
- SA1029 # Inappropriate key in call to 'context.WithValue'
- SA1030 # Invalid argument in call to a 'strconv' function
- SA1031 # Overlapping byte slices passed to an encoder
- SA1032 # Wrong order of arguments to 'errors.Is'
- SA2000 # 'sync.WaitGroup.Add' called inside the goroutine
- SA2001 # Empty critical section
- SA2002 # Called 'testing.T.FailNow' or 'SkipNow' in a goroutine
- SA2003 # Deferred 'Lock' right after locking
- SA3000 # 'TestMain' doesn't call 'os.Exit'
- SA3001 # Assigning to 'b.N' in benchmarks
- SA4000 # Binary operator has identical expressions on both sides
- SA4001 # '&*x' gets simplified to 'x'
- SA4003 # Comparing unsigned values against negative values
- SA4004 # The loop exits unconditionally after one iteration
- SA4005 # Field assignment that will never be observed
- SA4006 # A value assigned to a variable is never read before being overwritten
- SA4008 # The variable in the loop condition never changes
- SA4009 # A function argument is overwritten before its first use
- SA4010 # The result of 'append' will never be observed anywhere
- SA4011 # Break statement with no effect
- SA4012 # Comparing a value against NaN
- SA4013 # Negating a boolean twice
- SA4014 # An if/else if chain has repeated conditions
- SA4015 # Calling functions like 'math.Ceil' on floats converted from integers
- SA4016 # Certain bitwise operations do not do anything useful
- SA4017 # Discarding the return values of a function without side effects
- SA4018 # Self-assignment of variables
- SA4019 # Multiple, identical build constraints in the same file
- SA4020 # Unreachable case clause in a type switch
- SA4021 # "x = append(y)" is equivalent to "x = y"
- SA4022 # Comparing the address of a variable against nil
- SA4023 # Impossible comparison of interface value with untyped nil
- SA4024 # Checking for impossible return value from a builtin function
- SA4025 # Integer division of literals that results in zero
- SA4026 # Go constants cannot express negative zero
- SA4027 # '(*net/url.URL).Query' returns a copy
- SA4028 # 'x % 1' is always zero
- SA4029 # Ineffective attempt at sorting slice
- SA4030 # Ineffective attempt at generating random number
- SA4031 # Checking never-nil value against nil
- SA4032 # Comparing 'runtime.GOOS' or 'runtime.GOARCH' against impossible value
- SA5000 # Assignment to nil map
- SA5001 # Deferring 'Close' before checking for a possible error
- SA5002 # The empty for loop ("for {}") spins
- SA5003 # Defers in infinite loops will never execute
- SA5004 # "for { select { ..." with an empty default branch spins
- SA5005 # The finalizer references the finalized object
- SA5007 # Infinite recursive call
- SA5008 # Invalid struct tag
- SA5009 # Invalid Printf call
- SA5010 # Impossible type assertion
- SA5011 # Possible nil pointer dereference
- SA5012 # Passing odd-sized slice to function expecting even size
- SA6000 # Using 'regexp.Match' or related in a loop
- SA6001 # Missing an optimization opportunity when indexing maps by byte slices
- SA6002 # Storing non-pointer values in 'sync.Pool'
- SA6003 # Converting a string to a slice of runes before ranging over it
- SA6005 # Inefficient string comparison with 'strings.ToLower' or 'strings.ToUpper'
- SA6006 # Using io.WriteString to write '[]byte'
- SA9001 # Defers in range loops may not run when you expect them to
- SA9002 # Using a non-octal 'os.FileMode'
- SA9003 # Empty body in an if or else branch
- SA9004 # Only the first constant has an explicit type
- SA9005 # Trying to marshal a struct with no public fields
- SA9006 # Dubious bit shifting of a fixed size integer value
- SA9007 # Deleting a directory that shouldn't be deleted
- SA9008 # 'else' branch of a type assertion is probably not reading the right value
- SA9009 # Ineffectual Go compiler directive
# S - Simplification
- S1000 # Use plain channel send or receive instead of single-case select
- S1001 # Replace for loop with call to copy
- S1002 # Omit comparison with boolean constant
- S1003 # Replace call to 'strings.Index' with 'strings.Contains'
- S1004 # Replace call to 'bytes.Compare' with 'bytes.Equal'
- S1005 # Drop unnecessary use of the blank identifier
- S1006 # Use "for { ... }" for infinite loops
- S1007 # Simplify regular expression by using raw string literal
- S1008 # Simplify returning boolean expression
- S1009 # Omit redundant nil check on slices, maps, and channels
- S1010 # Omit default slice index
- S1011 # Use a single 'append' to concatenate two slices
- S1012 # Replace 'time.Now().Sub(x)' with 'time.Since(x)'
- S1016 # Use a type conversion instead of manually copying struct fields
- S1017 # Replace manual trimming with 'strings.TrimPrefix'
- S1018 # Use "copy" for sliding elements
- S1019 # Simplify "make" call by omitting redundant arguments
- S1020 # Omit redundant nil check in type assertion
- S1021 # Merge variable declaration and assignment
- S1023 # Omit redundant control flow
- S1024 # Replace 'x.Sub(time.Now())' with 'time.Until(x)'
- S1025 # Don't use 'fmt.Sprintf("%s", x)' unnecessarily
- S1028 # Simplify error construction with 'fmt.Errorf'
- S1029 # Range over the string directly
- S1030 # Use 'bytes.Buffer.String' or 'bytes.Buffer.Bytes'
- S1031 # Omit redundant nil check around loop
- S1032 # Use 'sort.Ints(x)', 'sort.Float64s(x)', and 'sort.Strings(x)'
- S1033 # Unnecessary guard around call to "delete"
- S1034 # Use result of type assertion to simplify cases
- S1035 # Redundant call to 'net/http.CanonicalHeaderKey'
- S1036 # Unnecessary guard around map access
- S1037 # Elaborate way of sleeping
- S1038 # Unnecessarily complex way of printing formatted string
- S1039 # Unnecessary use of 'fmt.Sprint'
- S1040 # Type assertion to current type
# QF - Quick Fix
- QF1001 # Apply De Morgan's law
- QF1002 # Convert untagged switch to tagged switch
- QF1003 # Convert if/else-if chain to tagged switch
- QF1004 # Use 'strings.ReplaceAll' instead of 'strings.Replace' with 'n == -1'
- QF1005 # Expand call to 'math.Pow'
- QF1006 # Lift 'if'+'break' into loop condition
- QF1007 # Merge conditional assignment into variable declaration
# - QF1008 # Omit embedded fields from selector expression
- QF1009 # Use 'time.Time.Equal' instead of '==' operator
- QF1010 # Convert slice of bytes to string when printing it
- QF1011 # Omit redundant type from variable declaration
- QF1012 # Use 'fmt.Fprintf(x, ...)' instead of 'x.Write(fmt.Sprintf(...))'
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
issues:
new-from-rev: ""
new: false
severity:
default: error
rules:
- linters:
- mnd
severity: ignore
formatters:
enable:
- gci
- gofmt
- gofumpt
settings:
gci:
sections:
- standard
- default
- prefix(github.com/free5gc)
gofmt:
simplify: true
goimports:
local-prefixes:
- github.com/org/project
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$