Debian Codegraph @

.golangci.yml

raw symbols SCIP
1 # Origin: https://github.com/powerman/golangci-lint-strict version 2.12.2
2 version: "2"
3 linters:
4 default: all
5 disable:
6 - containedctx # Questionable.
7 - contextcheck # Questionable.
8 - cyclop # Prefer gocognit.
9 - dogsled # Questionable (assignment to how many blank identifiers is not okay?).
10 - dupl
11 - forcetypeassert # Questionable (often we actually want panic).
12 - gocyclo # Prefer gocognit.
13 - gomodguard # Deprecated.
14 - interfacebloat # Questionable.
15 - ireturn # Questionable (is returning unexported types better?).
16 - lll # Questionable (sometimes long lines improve readability).
17 - nlreturn # Questionable (often no blank line before return improve readability).
18 - nonamedreturns # Questionable (named return act as a documentation).
19 - perfsprint # Questionable (force performance over readability and sometimes safety).
20 - varnamelen
21 - wrapcheck # Questionable (see https://github.com/tomarrell/wrapcheck/issues/1).
22 - wsl # Questionable (too much style differences, hard to consider).
23 - wsl_v5 # Questionable (too much style differences, hard to consider).
24 settings:
25 decorder:
26 disable-init-func-first-check: false # `init` funcs have to be declared before all other functions.
27 depguard:
28 rules:
29 main:
30 deny:
31 - pkg: math/rand$
32 desc: use math/rand/v2
33 - pkg: github.com/prometheus/common/log
34 desc: Should be replaced by standard lib log/slog package
35 - pkg: github.com/sirupsen/logrus
36 desc: Should be replaced by standard lib log/slog package
37 - pkg: github.com/go-errors/errors
38 desc: Should be replaced by standard lib errors package
39 - pkg: github.com/pkg/errors
40 desc: Should be replaced by standard lib errors package
41 - pkg: github.com/prometheus/client_golang/prometheus/promauto
42 desc: Not allowed because it uses global variables
43 - pkg: github.com/golang/protobuf
44 desc: Should be replaced by google.golang.org/protobuf package
45 - pkg: github.com/grpc-ecosystem/go-grpc-middleware$
46 desc: Should be replaced by github.com/grpc-ecosystem/go-grpc-middleware/v2
47 - pkg: github.com/grpc-ecosystem/go-grpc-prometheus
48 desc: Should be replaced by github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus
49 dupl:
50 threshold: 100
51 embeddedstructfieldcheck:
52 forbid-mutex: true
53 errcheck:
54 exclude-functions:
55 - encoding/json.Marshal # Required because of errchkjson.check-error-free-encoding.
56 - encoding/json.MarshalIndent # Required because of errchkjson.check-error-free-encoding.
57 errchkjson:
58 check-error-free-encoding: true
59 report-no-exported: true # Encoded struct must have exported fields.
60 exhaustive:
61 check:
62 - switch
63 - map
64 explicit-exhaustive-map: true # Only check maps with "//exhaustive:enforce" comment.
65 exhaustruct:
66 include:
67 - ^$ # Only check structs which domain.tld/package/name.structname match this regexp.
68 fatcontext:
69 check-struct-pointers: true
70 forbidigo:
71 forbid:
72 - pattern: ^print(ln)?$
73 exclude-godoc-examples: false
74 analyze-types: true
75 funcorder:
76 struct-method: false
77 gochecksumtype:
78 default-signifies-exhaustive: false
79 include-shared-interfaces: true
80 gocognit:
81 min-complexity: 20
82 gocritic:
83 enable-all: true
84 disabled-checks:
85 - exposedSyncMutex # Questionable.
86 - hugeParam # Premature optimization.
87 - paramTypeCombine # Questionable.
88 - switchTrue # Questionable.
89 - todoCommentWithoutDetail # Questionable.
90 - yodaStyleExpr # Questionable.
91 settings:
92 captLocal:
93 paramsOnly: false # Do not restrict checker to params only.
94 ruleguard:
95 failOn: all
96 truncateCmp:
97 skipArchDependent: false # Do not skip int/uint/uintptr types.
98 underef:
99 skipRecvDeref: false
100 unnamedResult:
101 checkExported: true
102 godoclint:
103 default: all
104 options:
105 max-len:
106 length: 97
107 godot:
108 exclude:
109 - :$ # Allow line followed by details in next line(s).
110 - '^\s*- ' # Allow line with a list item.
111 godox:
112 keywords:
113 - BUG # Marks issues that should be moved to issue tracker before merging.
114 - FIXME # Marks issues that should be resolved before merging.
115 - DEBUG # Marks temporary code that should be removed before merging.
116 gomodguard_v2:
117 blocked:
118 - module: github.com/cenkalti/backoff
119 version: < 4.0.0
120 reason: use actual version
121 gosec:
122 excludes:
123 - G104 # Audit errors not checked
124 config:
125 global:
126 audit: true
127 govet:
128 enable-all: true
129 disable:
130 - fieldalignment
131 settings:
132 shadow:
133 strict: true
134 grouper:
135 import-require-single-import: true # Use a single 'import' declaration.
136 iface:
137 enable:
138 - identical # Identifies interfaces in the same package that have identical method sets.
139 - unused # Identifies interfaces that are not used anywhere in the same package where the interface is defined.
140 - opaque # Identifies functions that return interfaces, but the actual returned value is always a single concrete implementation.
141 - unexported # Identifies interfaces that are not exported but are used in exported functions or methods.
142 importas:
143 alias:
144 - pkg: errors
145 alias: ""
146 - pkg: net/url
147 alias: urlpkg
148 loggercheck:
149 require-string-key: true # Logging keys must be inlined constant strings.
150 no-printf-like: true
151 misspell:
152 mode: restricted # Check only comments.
153 nestif:
154 min-complexity: 4
155 nilnil:
156 detect-opposite: true
157 nolintlint:
158 require-explanation: true # Disable linters this way: //nolint:first,second // Reason here.
159 require-specific: true # Do not allow //nolint without specific linter name(s).
160 paralleltest:
161 check-cleanup: true
162 reassign:
163 patterns:
164 - .* # Check all global variables.
165 revive:
166 rules:
167 - name: add-constant
168 disabled: true # Duplicates goconst and mnd linters.
169 - name: argument-limit
170 disabled: true # Questionable.
171 - name: atomic
172 - name: banned-characters
173 arguments: [] # [ "Ω","Σ","σ", "7" ]
174 - name: bare-return
175 disabled: true # Questionable (in some cases bare return improves readability).
176 - name: blank-imports
177 - name: bool-literal-in-expr
178 - name: call-to-gc
179 - name: cognitive-complexity
180 disabled: true # Duplicates gocognit linter.
181 - name: comment-spacings
182 arguments:
183 - nolint # Allow //nolint without a space.
184 - name: comments-density
185 disabled: true # Questionable.
186 - name: confusing-naming
187 disabled: true # Questionable (valid use case: Method() as a thin wrapper for method()).
188 - name: confusing-results
189 - name: constant-logical-expr
190 - name: context-as-argument
191 arguments:
192 - allowTypesBefore: '*testing.T,*check.C' # Test helpers keep t first.
193 - name: context-keys-type
194 - name: cyclomatic
195 disabled: true # Duplicates cyclop and gocyclo linters.
196 - name: datarace
197 - name: deep-exit
198 - name: defer
199 - name: dot-imports
200 - name: duplicated-imports
201 - name: early-return
202 - name: empty-block
203 disabled: true # https://github.com/mgechev/revive/issues/386
204 - name: empty-lines
205 - name: enforce-map-style
206 arguments:
207 - make # Use `make(map[A]B)` instead of literal `map[A]B{}`.
208 - name: enforce-repeated-arg-type-style
209 disabled: true # Questionable (short form for similar args and full otherwise may improve readability).
210 - name: enforce-slice-style
211 disabled: true # Questionable (sometimes we need a nil slice, sometimes not nil).
212 - name: enforce-switch-style
213 arguments:
214 - allowNoDefault
215 - name: epoch-naming
216 - name: error-naming
217 - name: error-return
218 - name: error-strings
219 - name: errorf
220 - name: exported
221 disabled: true # Duplicates godoclint.
222 - name: file-header
223 - name: file-length-limit
224 - name: filename-format
225 - name: flag-parameter
226 - name: forbidden-call-in-wg-go
227 - name: function-length
228 disabled: true # Duplicates funlen linter.
229 - name: function-result-limit
230 disabled: true # Questionable.
231 - name: get-return
232 - name: identical-branches
233 - name: identical-ifelseif-branches
234 - name: identical-ifelseif-conditions
235 - name: identical-switch-branches
236 - name: identical-switch-conditions
237 - name: if-return
238 - name: import-alias-naming
239 - name: import-shadowing
240 - name: imports-blocklist
241 - name: increment-decrement
242 - name: indent-error-flow
243 - name: inefficient-map-lookup
244 - name: line-length-limit
245 disabled: true # Duplicates lll linter.
246 - name: max-control-nesting
247 - name: max-public-structs
248 disabled: true # Questionable.
249 - name: modifies-parameter
250 - name: modifies-value-receiver
251 - name: nested-structs
252 disabled: true # Questionable (useful in tests, may worth enabling for non-tests).
253 - name: optimize-operands-order
254 - name: package-comments
255 - name: package-directory-mismatch
256 - name: package-naming
257 - name: range
258 - name: range-val-address
259 - name: range-val-in-closure
260 - name: receiver-naming
261 - name: redefines-builtin-id
262 - name: redundant-build-tag
263 - name: redundant-import-alias
264 - name: redundant-test-main-exit
265 - name: string-format
266 arguments:
267 - - fmt.Errorf[0]
268 - /(^|[^\.!?])$/
269 - must not end in punctuation
270 - - panic
271 - /^[^\n]*$/
272 - must not contain line breaks
273 - name: string-of-int
274 - name: struct-tag
275 - name: superfluous-else
276 - name: time-date
277 - name: time-equal
278 - name: time-naming
279 - name: unchecked-type-assertion
280 disabled: true # Duplicates errcheck and forcetypeassert linters.
281 - name: unconditional-recursion
282 - name: unexported-naming
283 - name: unexported-return
284 - name: unhandled-error
285 disabled: true # Duplicates errcheck linter.
286 - name: unnecessary-format
287 - name: unnecessary-if
288 - name: unnecessary-stmt
289 - name: unreachable-code
290 - name: use-slices-sort
291 - name: unsecure-url-scheme
292 - name: unused-parameter
293 - name: unused-receiver
294 - name: use-any
295 - name: use-errors-new
296 - name: use-fmt-print
297 - name: use-slices-sort
298 - name: use-waitgroup-go
299 - name: useless-break
300 - name: useless-fallthrough
301 - name: var-declaration
302 - name: var-naming
303 - name: waitgroup-by-value
304 rowserrcheck:
305 packages:
306 - github.com/jmoiron/sqlx
307 - github.com/powerman/sqlxx
308 sloglint:
309 context: scope
310 static-msg: true
311 msg-style: capitalized
312 forbidden-keys:
313 - time # Used by standard slog.JSONHandler or slog.TextHandler.
314 - level # Used by standard slog.JSONHandler or slog.TextHandler.
315 - msg # Used by standard slog.JSONHandler or slog.TextHandler.
316 - source # Used by standard slog.JSONHandler or slog.TextHandler.
317 key-naming-case: snake
318 tagalign:
319 order:
320 - json
321 - yaml
322 - yml
323 - toml
324 - cmd
325 - arg
326 - embed
327 - hidden
328 - passthrough
329 - optional
330 - required
331 - default
332 - envprefix
333 - env
334 - name
335 - enum
336 - help
337 - mod
338 - mapstructure
339 - binding
340 - mold
341 - validate
342 strict: true
343 tagliatelle:
344 case:
345 rules:
346 json: snake
347 yaml: kebab
348 xml: camel
349 toml: camel
350 bson: camel
351 avro: snake
352 mapstructure: kebab
353 envconfig: upperSnake
354 whatever: snake
355 testifylint:
356 enable-all: true
357 testpackage:
358 skip-regexp: .*_internal_test\.go
359 thelper:
360 test:
361 name: false # Allow *testing.T param to have any name, not only `t`.
362 usestdlibvars:
363 time-date-month: true
364 time-month: true
365 time-layout: true
366 crypto-hash: true
367 default-rpc-path: true
368 sql-isolation-level: true
369 tls-signature-scheme: true
370 wrapcheck:
371 report-internal-errors: true
372 exclusions:
373 rules:
374 - linters:
375 - govet
376 text: declaration of "(log|err|ctx)" shadows
377 - path: _test\.go|testing(_.*)?\.go
378 linters:
379 - bodyclose
380 - dupl
381 - errcheck
382 - fatcontext
383 - forcetypeassert
384 - funlen
385 - gochecknoglobals
386 - gochecknoinits
387 - gocognit
388 - goconst
389 - godoclint
390 - gosec
391 - maintidx
392 - reassign
393 - path: _test\.go|testing(_.*)?\.go
394 text: (unnamedResult|exitAfterDefer|rangeValCopy|unnecessaryBlock)
395 linters:
396 - gocritic
397 - path: _test\.go
398 text: '"t" shadows'
399 linters:
400 - govet
401 - path: ^(.*/)?embed.go$
402 linters:
403 - gochecknoglobals
404 - source: '[Cc]onst' # Define global const-vars like: var SomeGlobal = []int{42} // Const.
405 linters:
406 - gochecknoglobals
407 - linters:
408 - lll
409 source: '^//go:generate '
410 - linters:
411 - staticcheck
412 text: 'SA5008: duplicate struct tag "set"' # Valid in Kong CLI.
413 - linters:
414 - godoclint
415 text: should have a godoc \("(String|Error|Format|(Marshal|Unmarshal)(Text|JSON))"\)
416 paths:
417 - \.[\w-]+\.go$ # Use this pattern to name auto-generated files.
418 - internal/spew/ # Vendored, keep upstream code unchanged.
419 - internal/difflib/ # Vendored, keep upstream code unchanged.
420 - internal/deepequal/ # Vendored, keep upstream code unchanged.
421 formatters:
422 enable:
423 - gci
424 - gofmt
425 - gofumpt
426 - goimports
427 - golines
428 settings:
429 gci:
430 sections:
431 - standard # Standard section: captures all standard packages.
432 - default # Default section: contains all imports that could not be matched to another section type.
433 - localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
434 no-inline-comments: true
435 no-prefix-comments: true
436 gofmt:
437 rewrite-rules:
438 - pattern: interface{}
439 replacement: any
440 - pattern: a[b:len(a)]
441 replacement: a[b:]
442 golines:
443 max-len: 200
444 tab-len: 8
445 reformat-tags: false
446 exclusions:
447 generated: strict
448 paths:
449 - \.[\w-]+\.go$ # Use this pattern to name auto-generated files.
450 - internal/spew/ # Vendored, keep upstream code unchanged.
451 - internal/difflib/ # Vendored, keep upstream code unchanged.
452 - internal/deepequal/ # Vendored, keep upstream code unchanged.
453 issues:
454 max-issues-per-linter: 0
455 max-same-issues: 0
456 output:
457 sort-order:
458 - linter
459 - severity
460 - file # filepath, line, and column.
461 show-stats: false
462 run:
463 timeout: 1m
464 modules-download-mode: readonly
465 severity:
466 default: error