Debian Codegraph @

build/golangci-lint/golangci.yaml

raw symbols SCIP
1 ######################################################################################################
2 # #
3 # Shoutrrr golangci-lint Configuration #
4 # #
5 # Shoutrrr: https://github.com/nicholas-fedor/shoutrrr/ #
6 # Golangci-lint: https://golangci-lint.run/ #
7 # yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json #
8 # #
9 ######################################################################################################
10
11 ######################################################################################################
12 # Version Configuration
13 # https://golangci-lint.run/docs/configuration/file/#version-configuration
14 ######################################################################################################
15 version: "2"
16
17 ######################################################################################################
18 # Linters Configuration
19 # https://golangci-lint.run/usage/linters/
20 ######################################################################################################
21 linters:
22 ####################################################################################################
23 # Default set of linters.
24 # The value can be: `standard`, `all`, `none`, or `fast`.
25 # Default: standard
26 # default: all
27
28 ####################################################################################################
29 enable:
30 ##################################################################################################
31 # Enabled linters that automatically resolve issues
32 ##################################################################################################
33 - canonicalheader # Canonicalheader checks whether net/http.Header uses canonical header.
34 - copyloopvar # A linter detects places where loop variables are copied.
35 - dupword # Checks for duplicate words in the source code.
36 - err113 # Go linter to check the errors handling expressions.
37 - errorlint # Errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
38 - exptostd # Detects functions from golang.org/x/exp/ that can be replaced by std functions.
39 - fatcontext # Detects nested contexts in loops and function literals.
40 - ginkgolinter # Enforces standards of using ginkgo and gomega.
41 - gocritic # Provides diagnostics that check for bugs, performance and style issues.
42 - godot # Check if comments end in a period.
43 - goheader # Checks if file header matches to pattern.
44 - govet # Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes.
45 - iface # Detect the incorrect use of interfaces, helping developers avoid interface pollution.
46 - importas # Enforces consistent import aliases.
47 - intrange # Intrange is a linter to find places where for loops could make use of an integer range.
48 - mirror # Reports wrong mirror patterns of bytes/strings usage.
49 - misspell # Finds commonly misspelled English words.
50 - modernize # A suite of analyzers that suggest simplifications to Go code, using modern language and library features.
51 - nakedret # Checks that functions with naked returns are not longer than a maximum size (can be zero).
52 - nlreturn # Nlreturn checks for a new line before return and branch statements to increase code clarity.
53 - nolintlint # Reports ill-formed or insufficient nolint directives.
54 - perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative.
55 - protogetter # Reports direct reads from proto message fields when getters should be used. [auto-fix]
56 - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
57 - sloglint # Ensure consistent code style when using log/slog.
58 - staticcheck # It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of the staticcheck as a library inside golangci-lint.
59 - tagalign # Check that struct tags are well aligned.
60 - testifylint # Checks usage of github.com/stretchr/testify.
61 - usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library.
62 - usetesting # Reports uses of functions with replacement inside the testing package.
63 - whitespace # Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc.
64 - wsl_v5 # Add or remove empty lines.
65 ##################################################################################################
66 # Enabled linters that require manual issue resolution
67 ##################################################################################################
68 - asasalint # Check for pass []any as any in variadic func(...any).
69 - asciicheck # Checks that all code identifiers does not have non-ASCII symbols in the name.
70 - bidichk # Checks for dangerous unicode character sequences.
71 - bodyclose # Checks whether HTTP response body is closed successfully.
72 - containedctx # Containedctx is a linter that detects struct contained context.Context field.
73 - contextcheck # Check whether the function uses a non-inherited context.
74 - decorder # Check declaration order and count of types, constants, variables and functions.
75 - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()).
76 - dupl # Detects duplicate fragments of code.
77 - durationcheck # Check for two durations multiplied together.
78 - embeddedstructfieldcheck # Embedded types should be at the top of the field list of a struct, and there must be an empty line separating embedded fields from regular fields.
79 - errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and reports occurrences where the check for the returned error can be omitted.
80 - errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.
81 - errcheck # Errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases.
82 - exhaustive # Check exhaustiveness of enum switch statements.
83 - exhaustruct_v5 # Checks if all structure fields are initialized
84 - forbidigo # Forbids identifiers.
85 - forcetypeassert # Finds forced type assertions.
86 - funcorder # Checks the order of functions, methods, and constructors.
87 - gocheckcompilerdirectives # Checks that go compiler directive comments (//go:) are valid.
88 - gochecksumtype # Run exhaustiveness checks on Go "sum types".
89 - goconst # Finds repeated strings that could be replaced by a constant.
90 - godoclint # Checks Golang's documentation practice (godoc).
91 - godox # Detects usage of FIXME, TODO and other keywords inside comments.
92 - gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
93 - goprintffuncname # Checks that printf-like functions are named with `f` at the end.
94 - gosec # Inspects source code for security problems.
95 - gosmopolitan # Report certain i18n/l10n anti-patterns in your Go codebase.
96 - grouper # Analyze expression groups.
97 - inamedparam # Reports interfaces with unnamed method parameters.
98 - ineffassign # Detects when assignments to existing variables are not used.
99 - iotamixing # Checks if iotas are being used in const blocks with other non-iota declarations.
100 - loggercheck # Checks key value pairs for common logger libraries (kitlog,klog,logr,zap).
101 - makezero # Finds slice declarations with non-zero initial length.
102 - mnd # An analyzer to detect magic numbers.
103 - musttag # Enforce field tags in (un)marshaled structs.
104 - nilerr # Finds the code that returns nil even if it checks that the error is not nil.
105 - nilnesserr # Reports constructs that checks for err != nil, but returns a different nil value error.
106 - nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value.
107 - noctx # Finds sending http request without context.Context.
108 - nonamedreturns # Reports all named returns.
109 - nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL.
110 - paralleltest # Detects missing usage of t.Parallel() method in your Go test.
111 - prealloc # Finds slice declarations that could potentially be pre-allocated.
112 - predeclared # Find code that shadows one of Go's predeclared identifiers.
113 - promlinter # Check Prometheus metrics naming via promlint.
114 - reassign # Checks that package variables are not reassigned.
115 - recvcheck # Checks for receiver type consistency.
116 - testableexamples # Linter checks if examples are testable (have an expected output). [fast]
117 - thelper # Thelper detects tests helpers which is not start with t.Helper() method.
118 - tparallel # Tparallel detects inappropriate usage of t.Parallel() method in your Go test codes.
119 - unconvert # Remove unnecessary type conversions.
120 - unparam # Reports unused function parameters.
121 - unqueryvet # Detects SELECT \* in SQL queries and SQL builders, preventing performance issues and encouraging explicit column selection.
122 - unused # Checks Go code for unused constants, variables, functions and types.
123 - varnamelen # Checks that the length of a variable's name matches its scope.
124 - wastedassign # Finds wasted assignment statements.
125 - wrapcheck # Checks that errors returned from external packages are wrapped.
126 - zerologlint # Detects the wrong usage of zerolog that a user forgets to dispatch with Send or Msg.
127 ####################################################################################################
128 disable:
129 - arangolint # Opinionated best practices for arangodb client.
130 - cyclop # Checks function and package cyclomatic complexity.
131 - depguard # Checks if package imports are in a list of acceptable packages.
132 - exhaustruct # Checks if all structure fields are initialized.
133 - funlen # Checks for long functions.
134 - gochecknoglobals # Check that no global variables exist.
135 - gochecknoinits # Checks that no init functions are present in Go code.
136 - gocognit # Computes and checks the cognitive complexity of functions.
137 - gocyclo # Computes and checks the cyclomatic complexity of functions. [fast]
138 - gomodguard # Allow and blocklist linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.
139 - interfacebloat # A linter that checks the number of methods inside an interface. [fast]
140 - ireturn # Accept Interfaces, Return Concrete Types.
141 - lll # Reports long lines.
142 - maintidx # Maintidx measures the maintainability index of each function.
143 - nestif # Reports deeply nested if statements.
144 - noinlineerr # Disallows inline error handling
145 - rowserrcheck # Checks whether Rows.Err of rows is checked successfully.
146 - spancheck # Checks for mistakes with OpenTelemetry/Census spans.
147 - sqlclosecheck # Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed.
148 - tagliatelle # Checks the struct tags.
149 - testpackage # Linter that makes you use a separate _test package.
150 - wsl # deprecated, replaced by wsl_v5 (whitespace linter)
151
152 ######################################################################################################
153 # Linter Settings Configuration
154 ######################################################################################################
155 settings:
156 ####################################################################################################
157 # https://golangci-lint.run/docs/linters/configuration/#copyloopvar
158 copyloopvar:
159 # Check all assigning the loop variable to another variable.
160 # Default: false
161 check-alias: true
162
163 ####################################################################################################
164 # https://golangci-lint.run/docs/linters/configuration/#decorder
165 decorder:
166 # Required order of `type`, `const`, `var` and `func` declarations inside a file.
167 # Default: types before constants before variables before functions.
168 dec-order:
169 - type
170 - const
171 - var
172 - func
173 # If true, underscore vars (vars with "_" as the name) will be ignored at all checks.
174 # Default: false (underscore vars are not ignored)
175 ignore-underscore-vars: false
176 # If true, order of declarations is not checked at all.
177 # Default: true (disabled)
178 disable-dec-order-check: false
179 # If true, `init` func can be anywhere in file (does not have to be declared before all other functions).
180 # Default: true (disabled)
181 disable-init-func-first-check: false
182 # If true, multiple global `type`, `const` and `var` declarations are allowed.
183 # Default: true (disabled)
184 disable-dec-num-check: true
185 # If true, type declarations will be ignored for dec num check.
186 # Default: false (type statements are not ignored)
187 disable-type-dec-num-check: false
188 # If true, const declarations will be ignored for dec num check.
189 # Default: false (const statements are not ignored)
190 disable-const-dec-num-check: false
191 # If true, var declarations will be ignored for dec num check.
192 # Default: false (var statements are not ignored)
193 disable-var-dec-num-check: false
194
195 ####################################################################################################
196 # https://golangci-lint.run/docs/linters/configuration/#errcheck
197 errcheck:
198 # Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
199 # Such cases aren't reported by default.
200 # Default: false
201 check-type-assertions: true
202 # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`.
203 # Such cases aren't reported by default.
204 # Default: false
205 check-blank: true
206 # To disable the errcheck built-in exclude list.
207 # See `-excludeonly` option in https://github.com/kisielk/errcheck#excluding-functions for details.
208 # Default: false
209 # disable-default-exclusions: true
210 # List of functions to exclude from checking, where each entry is a single function to exclude.
211 # See https://github.com/kisielk/errcheck#excluding-functions for details.
212 exclude-functions:
213 - (*strings.Builder).Write
214 - (*strings.Builder).WriteString
215 - (*bytes.Buffer).Write
216 - (*bytes.Buffer).WriteString
217 - fmt.Fprintf
218 - fmt.Fprint
219 # Display function signature instead of selector.
220 # Default: false
221 verbose: true
222
223 ####################################################################################################
224 # https://golangci-lint.run/docs/linters/configuration/#exhaustruct_v5
225 exhaustruct_v5:
226 # List of regular expressions to match type names that should be checked.
227 # Anonymous structs can be matched by '<anonymous>' alias.
228 #
229 # Each regular expression must match the full type name, including package path.
230 # For example, to match type `net/http.Cookie` regular expression should be `.*/http\.Cookie`,
231 # but not `http\.Cookie`.
232 # Default: []
233 # enforce-patterns:
234 # - '.+\.Test'
235 # - 'example\.com/package\.ExampleStruct[\d]{1,2}'
236 # List of regular expressions to match type names that should be skipped from checking.
237 # Anonymous structs can be matched by '<anonymous>' alias.
238 # Has precedence over `enforce-patterns`.
239 # Each regular expression must match the full type name, including package path.
240 # For example, to match type `net/http.Cookie` regular expression should be `.*/http\.Cookie`,
241 # but not `http\.Cookie`.
242 # Default: []
243 ignore-patterns:
244 # Exclude test files - pattern matches type names from test files
245 - '.*_test\.\w+$'
246 # Exclude cobra.Command - typically used with partial initialization
247 - '.+/cobra\.Command$'
248 # Exclude internal/testutils package - test utilities
249 - 'github\.com/nicholas-fedor/shoutrrr/internal/testutils/.*'
250 # Exclude service types - initialized via factory functions
251 - 'github\.com/nicholas-fedor/shoutrrr/pkg/services/.+\.Service'
252 # Exclude config types - initialized via URL parsing (setURL method)
253 - 'github\.com/nicholas-fedor/shoutrrr/pkg/services/.+\.Config'
254 # Exclude payload types - initialized via URL parsing (setURL method)
255 - 'github\.com/nicholas-fedor/shoutrrr/pkg/services/.+Payload'
256 # Exclude message/body types - partially initialized with fields set conditionally
257 - 'github\.com/nicholas-fedor/shoutrrr/pkg/services/.+\.(TextContent|RequestBody|Message)$'
258 # Exclude standard library types that don't require full initialization
259 - '.*/url\.URL$'
260 - '.*/http\.Client$'
261 - '.*/http\.Transport$'
262 - '.*/http\.Request$'
263 - '.*/http\.Response$'
264 - '.*/tls\.Config$'
265 # Exclude third-party OAuth types
266 - '.*/oauth2\.Endpoint'
267 - '.*/oauth2\.Config'
268 # Exclude tls.Dialer - embedded net.Dialer with zero-value defaults
269 - '.*/tls\.Dialer'
270 # List of regular expressions to match type names where
271 # all fields are treated as optional. Anonymous structs can be matched by
272 # '<anonymous>' alias.
273 #
274 # Each regular expression must match the full type name, including package path.
275 # For example, to match type `net/http.Cookie` regular expression should be
276 # `.*/http\.Cookie`, but not `http\.Cookie`.
277 # Default: []
278 # optional-patterns:
279 # - '.+Foo'
280 # Allows empty structures, effectively excluding them from the check.
281 # Default: false
282 allow-empty: true
283 # List of regular expressions to match type names that should be allowed to be empty.
284 # Anonymous structs can be matched by '<anonymous>' alias.
285 # Each regular expression must match the full type name, including package path.
286 # For example, to match type `net/http.Cookie` regular expression should be `.*/http\.Cookie`,
287 # but not `http\.Cookie`.
288 # Default: []
289 # allow-empty-patterns:
290 # - '.*/http\.Cookie'
291 # Allows empty structures in return statements.
292 # Default: false
293 allow-empty-returns: true
294 # Allows empty structures in variable declarations.
295 # Default: false
296 allow-empty-declarations: true
297 # When true, only types marked with //exhaustruct:enforce directive or matching enforce-patterns are checked.
298 # Default: false
299 # explicit-mode: true
300
301 ####################################################################################################
302 # https://golangci-lint.run/docs/linters/configuration/#forbidigo
303 forbidigo:
304 # Forbid the following identifiers (list of regexp).
305 # Default: ["^(fmt\\.Print(|f|ln)|print|println)$"]
306 forbid:
307 # Default
308 - pattern: ^(fmt\\.Print(|f|ln)|print|println)$
309 # Use new https://pkg.go.dev/math/rand/v2
310 - pattern: math/rand\.
311 msg: Use math/rand/v2 instead
312 # Prevent use of deprecated https://pkg.go.dev/io/ioutil
313 - pattern: io/ioutil
314 msg: Use io or os packages instead
315 # Prevent use of syscall package https://go.googlesource.com/proposal/+/refs/heads/master/design/freeze-syscall.md
316 - pattern: syscall\.
317 msg: Use golang.org/x/sys instead
318 # Exclude godoc examples from forbidigo checks.
319 # Default: true
320 # exclude-godoc-examples: false
321 # Instead of matching the literal source code,
322 # use type information to replace expressions with strings that contain the package name
323 # and (for methods and fields) the type name.
324 # This makes it possible to handle import renaming and forbid struct fields and methods.
325 # Default: false
326 # analyze-types: true
327
328 ####################################################################################################
329 # https://golangci-lint.run/docs/linters/configuration/#funcorder
330 funcorder:
331 # Checks that constructors are placed after the structure declaration.
332 # Default: true
333 constructor: true
334 # Checks if the exported methods of a structure are placed before the non-exported ones.
335 # Default: true
336 struct-method: true
337 # Checks if the constructors and/or structure methods are sorted alphabetically.
338 # Default: false
339 alphabetical: true
340
341 ####################################################################################################
342 # https://golangci-lint.run/docs/linters/configuration/#goconst
343 goconst:
344 # Minimal length of string constant.
345 # Default: 3
346 min-len: 3
347 # Minimum occurrences of constant string count to trigger issue.
348 # Default: 3
349 min-occurrences: 5
350 # Look for existing constants matching the values.
351 # Default: true
352 match-constant: false
353 # Search also for duplicated numbers.
354 # Default: false
355 numbers: false
356 # Minimum value, only works with `goconst.numbers`.
357 # Default: 3
358 min: 3
359 # Maximum value, only works with `goconst.numbers`.
360 # Default: 3
361 max: 3
362 # Ignore when constant is not used as function argument.
363 # Default: true
364 ignore-calls: false
365 # Exclude strings matching the given regular expression.
366 # Default: ""
367 ignore-string-values:
368 - ""
369 # Detects constants with identical values.
370 # Default: false
371 find-duplicates: true
372 # Evaluates of constant expressions like Prefix + "suffix".
373 # Default: false
374 eval-const-expressions: false
375 # Ignore strings from test files.
376 # Default: false
377 ignore-tests: true
378 # Ignore string literals in calls to these functions
379 # Default: empty list
380 ignore-functions:
381 - "log.*"
382 - "slog.*"
383 - "fmt.Printf"
384 - "fmt.Errorf"
385 - "errors.New"
386
387 ####################################################################################################
388 # https://golangci-lint.run/docs/linters/configuration/#gocritic
389 gocritic:
390 # Enable all checks.
391 # Default: false
392 enable-all: true
393 # Disable checks that conflict with nonamedreturns linter
394 # Default: []
395 disabled-checks:
396 - unnamedResult
397
398 ####################################################################################################
399 # https://golangci-lint.run/docs/linters/configuration/#gosec
400 gosec:
401 # To select a subset of rules to run.
402 # Available rules: https://github.com/securego/gosec#available-rules
403 # Default: [] - means include all rules
404 # includes:
405 # - G101 # Look for hardcoded credentials
406 # To specify a set of rules to explicitly exclude.
407 # Available rules: https://github.com/securego/gosec#available-rules
408 # Default: []
409 excludes:
410 - G402 # TLS InsecureSkipVerify - intentional for dev/testing/internal networks
411 - G704 # SSRF via taint analysis - this is a http client library
412 - G705 # XSS via taint analysis - false positives for CLI console output
413
414 ####################################################################################################
415 # https://golangci-lint.run/docs/linters/configuration/#misspell
416 misspell:
417 locale: US
418
419 ####################################################################################################
420 # https://golangci-lint.run/docs/linters/configuration/#nakedret
421 nakedret:
422 # Make an issue if func has more lines of code than this setting, and it has naked returns.
423 # Default: 30
424 max-func-lines: 10
425
426 ####################################################################################################
427 # https://golangci-lint.run/docs/linters/configuration/#revive
428 revive:
429 enable-all-rules: false
430 # Configure rules
431 rules:
432 # Rule to check for meaningless package names
433 # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#var-naming
434 - name: var-naming
435 severity: warning
436 disabled: false
437 exclude: [""]
438 arguments:
439 - [""] # AllowList
440 - [""] # DenyList
441 - - skip-initialism-name-checks: false
442 upper-case-const: true
443 skip-package-name-checks: true
444 skip-package-name-collision-with-go-std: true
445 extra-bad-package-names:
446 - helpers
447 - models
448 # Rule to check for package name conflicts
449 # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#package-comments
450 - name: package-comments
451 severity: warning
452 disabled: false
453 exclude:
454 - ".*pkg/api/metrics/.*"
455 - ".*pkg/metrics/.*"
456
457 ####################################################################################################
458 # https://golangci-lint.run/docs/linters/configuration/#paralleltest
459 paralleltest:
460 # Ignore missing calls to `t.Parallel()` and only report incorrect uses of it.
461 # Default: false
462 # ignore-missing: true
463 # Ignore missing calls to `t.Parallel()` in subtests. Top-level tests are
464 # still required to have `t.Parallel`, but subtests are allowed to skip it.
465 # Default: false
466 ignore-missing-subtests: true
467
468 ####################################################################################################
469 # https://golangci-lint.run/docs/linters/configuration/#testifylint
470 testifylint:
471 enable-all: true
472
473 ####################################################################################################
474 # https://golangci-lint.run/docs/linters/configuration/#wrapcheck
475 wrapcheck:
476 # An array of strings specifying additional substrings of signatures to ignore.
477 # Unlike 'ignore-sigs', this option extends the default set (or the set specified in 'ignore-sigs') without replacing it entirely.
478 # This allows you to add specific signatures to the ignore list
479 # while retaining the defaults or any items in 'ignore-sigs'.
480 # Default: []
481 # extra-ignore-sigs:
482 # - .CustomError(
483 # - .SpecificWrap(
484 # An array of strings that specify substrings of signatures to ignore.
485 # If this set, it will override the default set of ignored signatures.
486 # See https://github.com/tomarrell/wrapcheck#configuration for more information.
487 # Default: [".Errorf(", "errors.New(", "errors.Unwrap(", "errors.Join(", ".Wrap(", ".Wrapf(", ".WithMessage(", ".WithMessagef(", ".WithStack("]
488 # ignore-sigs:
489 # - .Errorf(
490 # - errors.New(
491 # - errors.Unwrap(
492 # - errors.Join(
493 # - .Wrap(
494 # - .Wrapf(
495 # - .WithMessage(
496 # - .WithMessagef(
497 # - .WithStack(
498 # An array of strings that specify regular expressions of signatures to ignore.
499 # Default: []
500 # ignore-sig-regexps:
501 # - \.New.*Error\(
502 # An array of strings that specify globs of packages to ignore.
503 # Default: []
504 ignore-package-globs:
505 - github.com/nicholas-fedor/shoutrrr/internal/*
506 - github.com/nicholas-fedor/shoutrrr/pkg/*
507 # An array of strings that specify regular expressions of interfaces to ignore.
508 # Default: []
509 # ignore-interface-regexps:
510 # - ^(?i)c(?-i)ach(ing|e)
511 # Determines whether wrapcheck should report errors returned from inside the package.
512 # Default: false
513 # report-internal-errors: true
514
515 ####################################################################################################
516 # https://golangci-lint.run/docs/linters/configuration/#varnamelen
517 varnamelen:
518 max-distance: 5
519 min-name-length: 3
520 check-return: true
521 check-type-param: true
522 ignore-type-assert-ok: true
523 ignore-map-index-ok: true
524 ignore-chan-recv-ok: true
525 ignore-names:
526 - err
527 - b
528 - c
529 - ctx
530 - i
531 - j
532 - tt
533 ignore-decls:
534 - c echo.Context
535 - t testing.T
536 - f *foo.Bar
537 - e error
538 - i int
539 - j int
540 - const C
541 - T any
542 - m map[string]int
543 - w http.ResponseWriter
544 - r *http.Request
545 - r http.Request
546 - r *net/http/Request
547 - r *mux.Router
548 - b strings.Builder{}
549 - c echo.Context
550 - t testing.T
551 - f *foo.Bar
552 - e error
553 - i int
554 - const C
555 - T any
556 - m map[string]int
557 - w http.ResponseWriter
558 - r *http.Request
559 - r http.Request
560 - r *http.Request
561 - r http.Request
562 - r *mux.Router
563 - r *mux.Router
564
565 ######################################################################################################
566 # Defines a set of rules to ignore issues.
567 # It does not skip the analysis, and so does not ignore "typecheck" errors.
568 exclusions:
569 # Mode of the generated files analysis.
570 #
571 # - `strict`: sources are excluded by strictly following the Go generated file convention.
572 # Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\.$`
573 # This line must appear before the first non-comment, non-blank text in the file.
574 # https://go.dev/s/generatedcode
575 # - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.
576 # - `disable`: disable the generated files exclusion.
577 #
578 # Default: lax
579 # generated: strict
580
581 ####################################################################################################
582 # Log a warning if an exclusion rule is unused.
583 # Default: false
584 warn-unused: true
585
586 ####################################################################################################
587 # Predefined exclusion rules.
588 # Default: []
589 presets:
590 - comments
591 - std-error-handling
592 - common-false-positives
593 - legacy
594
595 ####################################################################################################
596 # Excluding configuration per-path, per-linter, per-text and per-source.
597 rules:
598 # Exclude some linters from running on tests files.
599 - path: ".*_test.go$"
600 linters:
601 - dupl
602 - err113
603 - errcheck
604 - errorlint
605 - exhaustive
606 - exhaustruct_v5
607 - forcetypeassert
608 - funlen
609 - gocyclo
610 - gosec
611 - gosmopolitan
612 - promlinter
613 - usetesting
614 - varnamelen
615 - wrapcheck
616 - bodyclose
617 # Exclude dupword from running on doc.go files.
618 - path: "doc.go$"
619 linters:
620 - dupword
621 # Exclude revive from flagging the internal/util package's name.
622 - path: "internal/util/.*"
623 linters:
624 - revive
625 text: "avoid meaningless package names"
626
627 # Run some linter only for test files by excluding its issues for everything else.
628 # - path-except: _test\.go
629 # linters:
630 # - forbidigo
631
632 # Exclude known linters from partially hard-vendored code,
633 # which is impossible to exclude via `nolint` comments.
634 # `/` will be replaced by the current OS file path separator to properly work on Windows.
635 # - path: internal/hmac/
636 # text: "weak cryptographic primitive"
637 # linters:
638 # - gosec
639
640 # Exclude some `staticcheck` messages.
641 # - linters:
642 # - staticcheck
643 # text: "SA9003:"
644
645 # Exclude `lll` issues for long lines with `go:generate`.
646 # - linters:
647 # - lll
648 # source: "^//go:generate "
649
650 # Exclude `gocheckcompilerdirectives` issues for `go:fix` directives.
651 - linters:
652 - gocheckcompilerdirectives
653 text: "compiler directive unrecognized: //go:fix"
654
655 ####################################################################################################
656 # Which file paths to exclude: they will be analyzed, but issues from them won't be reported.
657 # "/" will be replaced by the current OS file path separator to properly work on Windows.
658 # Default: []
659 paths:
660 # - ".*\\.my\\.go$"
661 # - lib/bad.go
662 - ".*/mocks/.*"
663 # - third_party$
664 # - builtin$
665 # - examples$
666
667 ####################################################################################################
668 # Which file paths to not exclude.
669 # Default: []
670 # paths-except:
671 # - ".*\\.my\\.go$"
672 # - lib/bad.go
673
674 ######################################################################################################
675 # Formatters Configuration
676 # https://golangci-lint.run/usage/configuration/#formatters-configuration
677 ######################################################################################################
678
679 formatters:
680 # Enable specific formatter.
681 # Default: []
682 enable:
683 ##################################################################################################
684 # Check if code and import statements are formatted, with additional rules.
685 - gci
686 ##################################################################################################
687 # Check if the code is formatted according to 'gofmt' command.
688 - gofmt
689 ##################################################################################################
690 # Check if code and import statements are formatted, with additional rules.
691 - gofumpt
692 ##################################################################################################
693 # Checks if the code and import statements are formatted according to the 'goimports' command.
694 - goimports
695 ##################################################################################################
696 # Checks if code is formatted, and fixes long lines.
697 - golines
698
699 ####################################################################################################
700 # Formatters settings.
701 # https://golangci-lint.run/docs/configuration/file/#formatters-configuration
702 ####################################################################################################
703 settings:
704 ##################################################################################################
705 # https://golangci-lint.run/docs/formatters/configuration/#gci
706 gci:
707 # Section configuration to compare against.
708 # Section names are case-insensitive and may contain parameters in ().
709 # The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`,
710 # If `custom-order` is `true`, it follows the order of `sections` option.
711 # Default: ["standard", "default"]
712 sections:
713 - standard # Standard section: captures all standard packages.
714 - default # Default section: contains all imports that could not be matched to another section type.
715 - prefix(github.com/nicholas-fedor/shoutrrr) # Custom section: groups all imports with the specified Prefix.
716 - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
717 - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
718 - alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
719 - localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
720 # Checks that no inline comments are present.
721 # Default: false
722 # no-inline-comments: true
723 # Checks that no prefix comments (comment lines above an import) are present.
724 # Default: false
725 # no-prefix-comments: true
726 # Enable custom order of sections.
727 # If `true`, make the section order the same as the order of `sections`.
728 # Default: false
729 # custom-order: true
730 # Drops lexical ordering for custom sections.
731 # Default: false
732 # no-lex-order: true
733 ##################################################################################################
734 # https://golangci-lint.run/docs/formatters/configuration/#gofmt
735 gofmt:
736 # Simplify code: gofmt with `-s` option.
737 # Default: true
738 # simplify: false
739 # Apply the rewrite rules to the source before reformatting.
740 # https://pkg.go.dev/cmd/gofmt
741 # Default: []
742 rewrite-rules:
743 # Go 1.18+: replace interface{} with any
744 - pattern: "interface{}"
745 replacement: "any"
746 # Slice expressions: a[b:len(a)] → a[b:]
747 - pattern: "a[b:len(a)]"
748 replacement: "a[b:]"
749 # a[:len(a)] → a[:] (full slice)
750 - pattern: "a[:len(a)]"
751 replacement: "a[:]"
752 # Go 1.21+: use slices.Clone instead of append(make([]T, len(s)), s...)
753 - pattern: "append(make([]T, len(s)), s...)"
754 replacement: "slices.Clone(s)"
755 # Go 1.21+: use slices.Delete instead of manual delete patterns
756 # i:j+1 where j = i + k, common delete pattern
757 - pattern: "a[:i+i+k:k+i+k]"
758 replacement: "slices.Delete(a, i, i+k)"
759 # strings.Clone (Go 1.20+)
760 - pattern: "string([]byte(s))"
761 replacement: "strings.Clone(s)"
762 # bytes.Clone (Go 1.20+)
763 - pattern: "append([]byte(nil), b...)"
764 replacement: "bytes.Clone(b)"
765 - pattern: "append(make([]byte, 0, len(b)), b...)"
766 replacement: "bytes.Clone(b)"
767 # Remove redundant type conversions in append
768 - pattern: "append([]T(nil), x)"
769 replacement: "append(make([]T, 0), x)"
770 # or better: just "[]T{x}" if building a new slice
771 ##################################################################################################
772 # https://golangci-lint.run/docs/formatters/configuration/#gofumpt
773 gofumpt:
774 module-path: "github.com/nicholas-fedor/shoutrrr"
775 extra:
776 group-params: true
777 clothe-returns: true
778 balance-calls: true
779 ##################################################################################################
780 # https://golangci-lint.run/docs/formatters/configuration/#goimports
781 goimports:
782 # A list of prefixes, which, if set, checks import paths
783 # with the given prefixes are grouped after 3rd-party packages.
784 # Default: []
785 local-prefixes:
786 - github.com/nicholas-fedor/shoutrrr
787 ##################################################################################################
788 # https://golangci-lint.run/docs/formatters/configuration/#golines
789 golines:
790 # Target maximum line length.
791 # Default: 100
792 max-len: 200
793 # Length of a tabulation.
794 # Default: 4
795 tab-len: 4
796 # Shorten single-line comments.
797 # Default: false
798 shorten-comments: true
799 # Default: true
800 reformat-tags: true
801 # Split chained methods on the dots as opposed to the arguments.
802 # Default: true
803 chain-split-dots: true
804
805 ####################################################################################################
806 exclusions:
807 ##################################################################################################
808 # Log a warning if an exclusion path is unused.
809 # Default: false
810 warn-unused: true
811 ##################################################################################################
812 # Mode of the generated files analysis.
813 #
814 # - `strict`: sources are excluded by strictly following the Go generated file convention.
815 # Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\.$`
816 # This line must appear before the first non-comment, non-blank text in the file.
817 # https://go.dev/s/generatedcode
818 # - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.
819 # - `disable`: disable the generated files exclusion.
820 #
821 # Default: lax
822 # generated: strict
823 ##################################################################################################
824 # Which file paths to exclude.
825 # Default: []
826 paths:
827 - ".*mocks$"
828 # - third_party$
829 # - builtin$
830 # - examples$
831
832 ######################################################################################################
833 # Issues Configuration
834 # https://golangci-lint.run/usage/configuration/#issues-configuration
835 ######################################################################################################
836 issues:
837 # Maximum issues count per one linter.
838 # Set to 0 to disable.
839 # Default: 50
840 max-issues-per-linter: 0
841
842 ####################################################################################################
843 # Maximum count of issues with the same text.
844 # Set to 0 to disable.
845 # Default: 3
846 max-same-issues: 0
847
848 ####################################################################################################
849 # Make issues output unique by line.
850 # Default: true
851 # uniq-by-line: false
852
853 ####################################################################################################
854 # Show only new issues: if there are unstaged changes or untracked files,
855 # only those changes are analyzed, else only changes in HEAD~ are analyzed.
856 # It's a super-useful option for integration of golangci-lint into existing large codebase.
857 # It's not practical to fix all existing issues at the moment of integration:
858 # much better don't allow issues in new code.
859 #
860 # Default: false
861 # new: true
862
863 ####################################################################################################
864 # Show only new issues created after the best common ancestor (merge-base against HEAD).
865 # Default: ""
866 # new-from-merge-base: main
867
868 ####################################################################################################
869 # Show only new issues created after git revision `REV`.
870 # Default: ""
871 # new-from-rev: HEAD
872
873 ####################################################################################################
874 # Show only new issues created in git patch with set file path.
875 # Default: ""
876 # new-from-patch: path/to/patch/file
877
878 ####################################################################################################
879 # Show issues in any part of update files (requires new-from-rev or new-from-patch).
880 # Default: false
881 whole-files: true
882
883 ####################################################################################################
884 # Fix found issues (if it's supported by the linter).
885 # Default: false
886 fix: true
887
888 ######################################################################################################
889 # Output Configuration
890 # https://golangci-lint.run/usage/configuration/#output-configuration
891 ######################################################################################################
892 output:
893 ####################################################################################################
894 # The formats used to render issues.
895 formats:
896 ##################################################################################################
897 # Prints issues in a text format with colors, line number, and linter name.
898 # This format is the default format.
899 text:
900 # Output path can be either `stdout`, `stderr` or path to the file to write to.
901 # Default: stdout
902 # path: ./path/to/output.txt
903
904 # Print linter name in the end of issue text.
905 # Default: true
906 # print-linter-name: false
907 print-linter-name: true
908
909 # Print lines of code with issue.
910 # Default: true
911 # print-issued-lines: false
912 print-issued-lines: true
913
914 # Use colors.
915 # Default: true
916 # colors: false
917 colors: true
918
919 ##################################################################################################
920 # Prints issues in a JSON representation.
921 # json:
922 # Output path can be either `stdout`, `stderr` or path to the file to write to.
923 # Default: stdout
924 # path: ./path/to/output.json
925 # path: stderr
926
927 ##################################################################################################
928 # Prints issues in columns representation separated by tabulations.
929 tab:
930 # Output path can be either `stdout`, `stderr` or path to the file to write to.
931 # Default: stdout
932 # path: ./path/to/output.txt
933 # Print linter name in the end of issue text.
934 # Default: true
935 print-linter-name: true
936 # Use colors.
937 # Default: true
938 # colors: false
939 colors: true
940
941 ##################################################################################################
942 # Prints issues in an HTML page.
943 # It uses the Cloudflare CDN (cdnjs) and React.
944 # html:
945 # Output path can be either `stdout`, `stderr` or path to the file to write to.
946 # Default: stdout
947 # path: ./path/to/output.html
948
949 ##################################################################################################
950 # Prints issues in the Checkstyle format.
951 # checkstyle:
952 # Output path can be either `stdout`, `stderr` or path to the file to write to.
953 # Default: stdout
954 # path: ./path/to/output.xml
955
956 ##################################################################################################
957 # Prints issues in the Code Climate format.
958 # code-climate:
959 # Output path can be either `stdout`, `stderr` or path to the file to write to.
960 # Default: stdout
961 # path: ./path/to/output.json
962
963 ##################################################################################################
964 # Prints issues in the JUnit XML format.
965 # junit-xml:
966 # Output path can be either `stdout`, `stderr` or path to the file to write to.
967 # Default: stdout
968 # path: ./path/to/output.xml
969 # Support extra JUnit XML fields.
970 # Default: false
971 # extended: true
972
973 ##################################################################################################
974 # Prints issues in the TeamCity format.
975 # teamcity:
976 # Output path can be either `stdout`, `stderr` or path to the file to write to.
977 # Default: stdout
978 # path: ./path/to/output.txt
979
980 ##################################################################################################
981 # Prints issues in the SARIF format.
982 # sarif:
983 # Output path can be either `stdout`, `stderr` or path to the file to write to.
984 # Default: stdout
985 # path: ./path/to/output.json
986
987 ####################################################################################################
988 # Add a prefix to the output file references.
989 # Default: ""
990 # path-prefix: ""
991
992 ####################################################################################################
993 # By default, the report are related to the path obtained by `run.relative-path-mode`.
994 # The mode `abs` allows to show absolute file paths instead of relative file paths.
995 # The option `output.path-prefix` is ignored when using `abs` mode.
996 # Default: ""
997 path-mode: "abs"
998
999 ####################################################################################################
1000 # Order to use when sorting results.
1001 # Possible values: `file`, `linter`, and `severity`.
1002 #
1003 # If the severity values are inside the following list, they are ordered in this order:
1004 # 1. error
1005 # 2. warning
1006 # 3. high
1007 # 4. medium
1008 # 5. low
1009 # Either they are sorted alphabetically.
1010 #
1011 # Default: ["linter", "file"]
1012 sort-order:
1013 - file # filepath, line, and column.
1014 - severity
1015 - linter
1016
1017 ####################################################################################################
1018 # Show statistics per linter.
1019 # Default: true
1020 # show-stats: false
1021
1022 ######################################################################################################
1023 # Run Configuration
1024 # Options for analysis running.
1025 # https://golangci-lint.run/usage/configuration/#run-configuration
1026 ######################################################################################################
1027 run:
1028 ####################################################################################################
1029 # Timeout for analysis, e.g. 30s, 5m, 5m30s.
1030 # If the value is lower or equal to 0, the timeout is disabled.
1031 # Default: 1m
1032 # timeout: 5m
1033
1034 ####################################################################################################
1035 # The mode used to evaluate relative paths.
1036 # It's used by exclusions, Go plugins, and some linters.
1037 # The value can be:
1038 # - `gomod`: the paths will be relative to the directory of the `go.mod` file.
1039 # - `gitroot`: the paths will be relative to the git root (the parent directory of `.git`).
1040 # - `cfg`: the paths will be relative to the configuration file.
1041 # - `wd` (NOT recommended): the paths will be relative to the place where golangci-lint is run.
1042 # Default: wd
1043 # relative-path-mode: gomod
1044
1045 ####################################################################################################
1046 # Exit code when at least one issue was found.
1047 # Default: 1
1048 # issues-exit-code: 2
1049
1050 ####################################################################################################
1051 # Include test files or not.
1052 # Default: true
1053 # tests: false
1054
1055 ####################################################################################################
1056 # List of build tags, all linters use it.
1057 # Default: []
1058 # build-tags:
1059 # - mytag
1060
1061 ####################################################################################################
1062 # If set, we pass it to "go list -mod={option}". From "go help modules":
1063 # If invoked with -mod=readonly, the go command is disallowed from the implicit
1064 # automatic updating of go.mod described above. Instead, it fails when any changes
1065 # to go.mod are needed. This setting is most useful to check that go.mod does
1066 # not need updates, such as in a continuous integration and testing system.
1067 # If invoked with -mod=vendor, the go command assumes that the vendor
1068 # directory holds the correct copies of dependencies and ignores
1069 # the dependency descriptions in go.mod.
1070 #
1071 # Allowed values: readonly|vendor|mod
1072 # Default: ""
1073 # modules-download-mode: readonly
1074
1075 ####################################################################################################
1076 # Allow multiple parallel golangci-lint instances running.
1077 # If false, golangci-lint acquires file lock on start.
1078 # Default: false
1079 allow-parallel-runners: true
1080
1081 ####################################################################################################
1082 # Allow multiple golangci-lint instances running, but serialize them around a lock.
1083 # If false, golangci-lint exits with an error if it fails to acquire file lock on start.
1084 # Default: false
1085 allow-serial-runners: true
1086
1087 ####################################################################################################
1088 # Define the Go version limit.
1089 # Mainly related to generics support since go1.18.
1090 # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.22.
1091 # go: "1.24"
1092
1093 ####################################################################################################
1094 # Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously.
1095 # If it is explicitly set to 0 (i.e. not the default) then golangci-lint will automatically set the value to match Linux container CPU quota.
1096 # Default: the number of logical CPUs in the machine
1097 # concurrency: 4
1098 ######################################################################################################
1099 # Severity Configuration
1100 # https://golangci-lint.run/usage/configuration/#severity-configuration
1101 ######################################################################################################
1102 # severity:
1103 ####################################################################################################
1104 # Set the default severity for issues.
1105 #
1106 # If severity rules are defined and the issues do not match or no severity is provided to the rule
1107 # this will be the default severity applied.
1108 # Severities should match the supported severity names of the selected out format.
1109 # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
1110 # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#SeverityLevel
1111 # - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
1112 # - TeamCity: https://www.jetbrains.com/help/teamcity/service-messages.html#Inspection+Instance
1113 #
1114 # `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...)
1115 #
1116 # Default: ""
1117 # default: error
1118
1119 ####################################################################################################
1120 # If set to true `severity-rules` regular expressions become case-sensitive.
1121 # Default: false
1122 # case-sensitive: true
1123
1124 ####################################################################################################
1125 # When a list of severity rules are provided, severity information will be added to lint issues.
1126 # Severity rules have the same filtering capability as exclude rules
1127 # except you are allowed to specify one matcher per severity rule.
1128 #
1129 # `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...)
1130 #
1131 # Only affects out formats that support setting severity information.
1132 #
1133 # Default: []
1134 # rules:
1135 # - linters:
1136 # - dupl
1137 # severity: info
1138 ######################################################################################################
1139 # End of golangci-lint Configuration
1140 ######################################################################################################