pool/.golangci.yml
2025-03-05 12:37:49 +02:00

125 lines
2.9 KiB
YAML

run:
# timeout for analysis
timeout: 4m
linters-settings:
govet:
# Don't report about shadowed variables
check-shadowing: false
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
tagliatelle:
case:
rules:
json: snake
whitespace:
multi-func: true
multi-if: true
gosec:
excludes:
- G402 # Look for bad TLS connection settings.
- G306 # Poor file permissions used when writing to a new file.
- G601 # Implicit memory aliasing in for loop.
- G115 # Integer overflow in conversion.
staticcheck:
go: "1.19"
checks: ["-SA1019"]
linters:
enable-all: true
disable:
# Global variables are used in many places throughout the code base.
- gochecknoglobals
# Some lines are over 80 characters on purpose and we don't want to make them
# even longer by marking them as 'nolint'.
- lll
# We want to allow short variable names.
- varnamelen
# We want to allow TODOs.
- godox
# We have long functions, especially in tests. Moving or renaming those would
# trigger funlen problems that we may not want to solve at that time.
- funlen
# Disable for now as we haven't yet tuned the sensitivity to our codebase
# yet. Enabling by default for example, would also force new contributors to
# potentially extensively refactor code, when they want to smaller change to
# land.
- gocyclo
- gocognit
- cyclop
# Instances of table driven tests that don't pre-allocate shouldn't trigger
# the linter.
- prealloc
# Init functions are used by loggers throughout the codebase.
- gochecknoinits
# Causes stack overflow, see https://github.com/polyfloyd/go-errorlint/issues/19.
- errorlint
# New linters that need a code adjustment first.
- intrange
- revive
- gosmopolitan
- goconst
- copyloopvar
- wrapcheck
- depguard
- inamedparam
- protogetter
- perfsprint
- tagalign
- testifylint
- nolintlint
- paralleltest
- tparallel
- testpackage
- gofumpt
- gomoddirectives
- ireturn
- maintidx
- nlreturn
- dogsled
- gci
- containedctx
- contextcheck
- errname
- exhaustruct
- err113
- noctx
- nestif
- wsl
- exhaustive
- forcetypeassert
- nilerr
- nilnil
- stylecheck
- thelper
- nosprintfhostport
- errchkjson
- revive
- promlinter
- forbidigo
- interfacebloat
# The linter is too aggressive and doesn't add much value since reviewers
# will also catch magic numbers that make sense to extract.
- mnd
issues:
# Only show newly introduced problems.
new-from-rev: c5b37702e0bead2408ba72aad792ea4ff9fc930f
exclude-rules:
# Exclude gosec from running for tests so that tests with weak randomness
# (math/rand) will pass the linter.
- path: _test\.go
linters:
- gosec