|
1 | 1 | [run]
|
2 | 2 | deadline = "10m"
|
3 |
| - |
4 | 3 | tests = true
|
5 | 4 |
|
6 | 5 | [linters]
|
7 | 6 | disable-all = true
|
8 | 7 | enable = [
|
| 8 | + "asasalint", |
9 | 9 | "asciicheck",
|
10 | 10 | "bidichk",
|
11 | 11 | "bodyclose",
|
12 | 12 | "containedctx",
|
13 | 13 | "contextcheck",
|
14 | 14 | "depguard",
|
| 15 | + "dupword", |
15 | 16 | "durationcheck",
|
16 | 17 | "errcheck",
|
17 | 18 | "errchkjson",
|
18 | 19 | "errname",
|
19 | 20 | "errorlint",
|
| 21 | + # "exhaustive", |
20 | 22 | "exportloopref",
|
21 | 23 | "forbidigo",
|
22 |
| - #"forcetypeassert", |
23 | 24 | "goconst",
|
24 | 25 | "gocyclo",
|
25 | 26 | "gocritic",
|
|
42 | 43 | "nosprintfhostport",
|
43 | 44 | "predeclared",
|
44 | 45 | "revive",
|
| 46 | + "rowserrcheck", |
45 | 47 | "sqlclosecheck",
|
46 | 48 | "staticcheck",
|
47 | 49 | "stylecheck",
|
|
51 | 53 | "unconvert",
|
52 | 54 | "unparam",
|
53 | 55 | "unused",
|
| 56 | + "usestdlibvars", |
54 | 57 | "vetshadow",
|
| 58 | + "wastedassign", |
55 | 59 | ]
|
56 | 60 |
|
| 61 | +[[linters-settings.depguard.rules.main.deny]] |
| 62 | +pkg = "io/ioutil" |
| 63 | +desc = "Deprecated. Functions have been moved elsewhere." |
| 64 | + |
57 | 65 | [linters-settings.errcheck]
|
| 66 | + check-blank = true |
58 | 67 | # Ignoring Close so that we don't have to have a bunch of
|
59 | 68 | # `defer func() { _ = r.Close() }()` constructs when we
|
60 | 69 | # don't actually care about the error.
|
|
68 | 77 | [linters-settings.exhaustive]
|
69 | 78 | default-signifies-exhaustive = true
|
70 | 79 |
|
| 80 | +[linters-settings.forbidigo] |
| 81 | + # Forbid the following identifiers |
| 82 | + forbid = [ |
| 83 | + "Geoip", # use "GeoIP" |
| 84 | + "^geoIP", # use "geoip" |
| 85 | + "Maxmind", # use "MaxMind" |
| 86 | + "^maxMind", # use "maxmind" |
| 87 | + ] |
| 88 | + |
71 | 89 | [linters-settings.gocritic]
|
72 | 90 | enabled-checks = [
|
73 | 91 | "appendAssign",
|
|
89 | 107 | "commentedOutImport",
|
90 | 108 | "commentFormatting",
|
91 | 109 | "defaultCaseOrder",
|
92 |
| - # Revive's defer rule already captures this. This caught no extra cases. |
93 |
| - # "deferInLoop", |
| 110 | + "deferInLoop", |
94 | 111 | "deferUnlambda",
|
95 | 112 | "deprecatedComment",
|
96 | 113 | "docStub",
|
|
109 | 126 | "exitAfterDefer",
|
110 | 127 | "exposedSyncMutex",
|
111 | 128 | "externalErrorReassign",
|
112 |
| - # Given that all of our code runs on Linux and the / separate should |
113 |
| - # work fine, this seems less important. |
114 |
| - # "filepathJoin", |
| 129 | + "filepathJoin", |
115 | 130 | "flagDeref",
|
116 | 131 | "flagName",
|
117 | 132 | "hexLiteral",
|
| 133 | + "httpNoBody", |
| 134 | + "hugeParam", |
118 | 135 | "ifElseChain",
|
119 | 136 | "importShadow",
|
120 | 137 | "indexAlloc",
|
|
138 | 155 | "redundantSprint",
|
139 | 156 | "regexpMust",
|
140 | 157 | "regexpPattern",
|
141 |
| - # This might be good, but I don't think we want to encourage |
142 |
| - # significant changes to regexes as we port stuff from Perl. |
143 |
| - # "regexpSimplify", |
| 158 | + "regexpSimplify", |
| 159 | + "returnAfterHttpError", |
144 | 160 | "ruleguard",
|
145 | 161 | "singleCaseSwitch",
|
146 | 162 | "sliceClear",
|
147 | 163 | "sloppyLen",
|
148 |
| - # This seems like it might also be good, but a lot of existing code |
149 |
| - # fails. |
150 |
| - # "sloppyReassign", |
151 |
| - "returnAfterHttpError", |
| 164 | + "sloppyReassign", |
| 165 | + "sloppyTestFuncName", |
152 | 166 | "sloppyTypeAssert",
|
153 | 167 | "sortSlice",
|
154 | 168 | "sprintfQuotedString",
|
155 | 169 | "sqlQuery",
|
156 | 170 | "stringsCompare",
|
| 171 | + "stringConcatSimplify", |
157 | 172 | "stringXbytes",
|
158 | 173 | "switchTrue",
|
159 | 174 | "syncMapLoadAndDelete",
|
|
168 | 183 | "underef",
|
169 | 184 | "unlabelStmt",
|
170 | 185 | "unlambda",
|
171 |
| - # I am not sure we would want this linter and a lot of existing |
172 |
| - # code fails. |
173 | 186 | # "unnamedResult",
|
174 | 187 | "unnecessaryBlock",
|
175 | 188 | "unnecessaryDefer",
|
176 | 189 | "unslice",
|
177 | 190 | "valSwap",
|
178 | 191 | "weakCond",
|
| 192 | + # Covered by nolintlint |
| 193 | + # "whyNoLint" |
179 | 194 | "wrapperFunc",
|
180 | 195 | "yodaStyleExpr",
|
181 |
| - # This requires explanations for "nolint" directives. This would be |
182 |
| - # nice for gosec ones, but I am not sure we want it generally unless |
183 |
| - # we can get the false positive rate lower. |
184 |
| - # "whyNoLint" |
185 | 196 | ]
|
186 | 197 |
|
187 | 198 | [linters-settings.gofumpt]
|
188 | 199 | extra-rules = true
|
189 | 200 | lang-version = "1.19"
|
190 | 201 |
|
| 202 | +[linters-settings.gosec] |
| 203 | + excludes = [ |
| 204 | + # G104 - "Audit errors not checked." We use errcheck for this. |
| 205 | + "G104", |
| 206 | + |
| 207 | + # G304 - "Potential file inclusion via variable" |
| 208 | + "G304", |
| 209 | + |
| 210 | + # G306 - "Expect WriteFile permissions to be 0600 or less". |
| 211 | + "G306", |
| 212 | + |
| 213 | + # Prohibits defer (*os.File).Close, which we allow when reading from file. |
| 214 | + "G307", |
| 215 | + ] |
| 216 | + |
191 | 217 | [linters-settings.govet]
|
192 | 218 | "enable-all" = true
|
| 219 | + disable = ["shadow"] |
193 | 220 |
|
194 | 221 | [linters-settings.lll]
|
195 | 222 | line-length = 120
|
|
206 | 233 | ignore-generated-header = true
|
207 | 234 | severity = "warning"
|
208 | 235 |
|
209 |
| - # This might be nice but it is so common that it is hard |
210 |
| - # to enable. |
211 | 236 | # [[linters-settings.revive.rules]]
|
212 | 237 | # name = "add-constant"
|
213 | 238 |
|
|
232 | 257 | # [[linters-settings.revive.rules]]
|
233 | 258 | # name = "cognitive-complexity"
|
234 | 259 |
|
235 |
| - # Probably a good rule, but we have a lot of names that |
236 |
| - # only have case differences. |
| 260 | + [[linters-settings.revive.rules]] |
| 261 | + name = "comment-spacings" |
| 262 | + arguments = ["easyjson", "nolint"] |
| 263 | + |
237 | 264 | # [[linters-settings.revive.rules]]
|
238 | 265 | # name = "confusing-naming"
|
239 | 266 |
|
|
252 | 279 | # [[linters-settings.revive.rules]]
|
253 | 280 | # name = "cyclomatic"
|
254 | 281 |
|
| 282 | + [[linters-settings.revive.rules]] |
| 283 | + name = "datarace" |
| 284 | + |
| 285 | + # [[linters-settings.revive.rules]] |
| 286 | + # name = "deep-exit" |
| 287 | + |
255 | 288 | [[linters-settings.revive.rules]]
|
256 | 289 | name = "defer"
|
257 | 290 |
|
|
288 | 321 | # [[linters-settings.revive.rules]]
|
289 | 322 | # name = "file-header"
|
290 | 323 |
|
291 |
| - # We have a lot of flag parameters. This linter probably makes |
292 |
| - # a good point, but we would need some cleanup or a lot of nolints. |
293 | 324 | # [[linters-settings.revive.rules]]
|
294 | 325 | # name = "flag-parameter"
|
295 | 326 |
|
|
329 | 360 | [[linters-settings.revive.rules]]
|
330 | 361 | name = "modifies-value-receiver"
|
331 | 362 |
|
332 |
| - # We frequently use nested structs, particularly in tests. |
333 | 363 | # [[linters-settings.revive.rules]]
|
334 | 364 | # name = "nested-structs"
|
335 | 365 |
|
|
363 | 393 | [[linters-settings.revive.rules]]
|
364 | 394 | name = "superfluous-else"
|
365 | 395 |
|
| 396 | + [[linters-settings.revive.rules]] |
| 397 | + name = "time-equal" |
| 398 | + |
366 | 399 | [[linters-settings.revive.rules]]
|
367 | 400 | name = "time-naming"
|
368 | 401 |
|
|
375 | 408 | [[linters-settings.revive.rules]]
|
376 | 409 | name = "unexported-return"
|
377 | 410 |
|
378 |
| - # This is covered elsewhere and we want to ignore some |
379 |
| - # functions such as fmt.Fprintf. |
380 | 411 | # [[linters-settings.revive.rules]]
|
381 | 412 | # name = "unhandled-error"
|
382 | 413 |
|
|
389 | 420 | [[linters-settings.revive.rules]]
|
390 | 421 | name = "unused-parameter"
|
391 | 422 |
|
392 |
| - # We generally have unused receivers in tests for meeting the |
393 |
| - # requirements of an interface. |
394 |
| - # [[linters-settings.revive.rules]] |
395 |
| - # name = "unused-receiver" |
| 423 | + [[linters-settings.revive.rules]] |
| 424 | + name = "unused-receiver" |
396 | 425 |
|
397 |
| - # This probably makes sense after we upgrade to 1.18 |
398 |
| - # [[linters-settings.revive.rules]] |
399 |
| - # name = "use-any" |
| 426 | + [[linters-settings.revive.rules]] |
| 427 | + name = "use-any" |
400 | 428 |
|
401 | 429 | [[linters-settings.revive.rules]]
|
402 | 430 | name = "useless-break"
|
|
413 | 441 | [linters-settings.unparam]
|
414 | 442 | check-exported = true
|
415 | 443 |
|
| 444 | +[issues] |
| 445 | +exclude-use-default = false |
| 446 | + |
416 | 447 | [[issues.exclude-rules]]
|
417 | 448 | linters = [
|
418 | 449 | "govet"
|
419 | 450 | ]
|
420 |
| - # we want to enable almost all govet rules. It is easier to just filter out |
421 |
| - # the ones we don't want: |
422 |
| - # |
423 |
| - # * fieldalignment - way too noisy. Although it is very useful in particular |
424 |
| - # cases where we are trying to use as little memory as possible, having |
425 |
| - # it go off on every struct isn't helpful. |
426 |
| - # * shadow - although often useful, it complains about _many_ err |
427 |
| - # shadowing assignments and some others where shadowing is clear. |
428 |
| - text = "^(fieldalignment|shadow)" |
| 451 | + path = "_test.go" |
| 452 | + text = "^fieldalignment" |
0 commit comments