Skip to content

Commit

Permalink
Adjust golangci-lint linters
Browse files Browse the repository at this point in the history
Added new linters (some commented out if not needed) and removed
deprecated linters.

Related to submariner-io/enhancements#231

Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis committed Nov 13, 2024
1 parent 2ddc95d commit dafd4d6
Showing 1 changed file with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,46 @@ linters-settings:
block-size: 2
wsl:
allow-trailing-comment: true
reassign:
patterns:
- "utilruntime.ErrorHandlers"
linters:
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
# - canonicalheader # This is a slow linter and we don't use the net/http.Header API
- containedctx
- contextcheck
- copyloopvar
# - cyclop # This is equivalent to gocyclo
# - decorder # We don't want to completely restrict declaration ordering, eg it's useful to group enumeration constants
# with the type declaration
# - depguard # depguard now denies by default, it should only be enabled if we actually use it
- dogsled
- dupl
- dupword
- durationcheck
- errcheck
- errchkjson
- errorlint
- errname
- exhaustive
# - exhaustivestruct # Not recommended for general use - meant to be used only for special cases
- exportloopref
# - exhaustruct # This is too cumbersome as it requires all string, int, pointer et al fields to be initialized even when the
# type's default suffices, which is most of the time
- fatcontext
# - forbidigo # We don't forbid any statements
# - forcetypeassert # There are many unchecked type assertions that would be the result of a programming error so the
# reasonable recourse would be to panic anyway if checked so this doesn't seem useful
# - funlen # gocyclo is enabled which is generally a better metric than simply LOC.
- gci
- ginkgolinter
- gocheckcompilerdirectives
# - gochecknoglobals # We don't want to forbid global variable constants
- gochecknoinits
# - gochecksumtype # The usefulness is very narrow
- gocognit
- goconst
- gocritic
Expand All @@ -74,55 +88,73 @@ linters:
- gofumpt
- goheader
- goimports
# - golint # Deprecated since v1.41.0
# - gomnd # It doesn't seem useful in general to enforce constants for all numeric values
# - gomoddirectives # We don't want to forbid the 'replace' directive
# - gomodguard # We don't block any modules
# - goprintffuncname # This doesn't seem useful at all
# - gosmopolitan # This is related to internationalization which is not a concern for us
- gosec
- gosimple
- govet
# - ifshort # This is a style preference and doesn't seem compelling
# - grouper # Grouping of const and var declarations is handled by gofumpt
- iface
- importas
- inamedparam
- ineffassign
# - interfacer # Deprecated since v1.38.0
# - interfacebloat # Don't restrict the number of interface methods
- intrange
# - ireturn # The argument to always "Return Concrete Types" doesn't seem compelling. It is perfectly valid to return
# an interface to avoid exposing the entire underlying struct
- lll
- loggercheck
- maintidx
- makezero
# - maligned # Deprecated since v1.38.0
- mirror
- misspell
# - mnd # It doesn't seem useful in general to enforce constants for all numeric values
- musttag
- nakedret
# - nestif # This calculates cognitive complexity but we're doing that elsewhere
- nilerr
- nilnil
# - nlreturn # This is reasonable with a block-size of 2 but setting it above isn't honored
# - noctx # We don't send HTTP requests
- nolintlint
- nonamedreturns
# - nosprintfhostport # The use of this is very narrow
# - paralleltest # Not relevant for Ginkgo UTs
- perfsprint
- prealloc
- predeclared
- promlinter
# - protogetter # We don't use protobuf
- reassign
- recvcheck
- revive
# - rowserrcheck # We don't use SQL
# - scopelint # Deprecated since v1.39.0
# - sloglint # We don't use log/slog
# - spancheck # We don't use OpenTelemetry/OpenCensus
# - sqlclosecheck # We don't use SQL
- staticcheck
- stylecheck
- tagalign
# - tagliatelle # Inconsistent with stylecheck and not as good
# - tenv # Not relevant for our Ginkgo UTs
# - testableexamples # We don't need this
# - testifylint # We don't use testify
- testpackage
# - thelper # Not relevant for our Ginkgo UTs
# - tparallel # Not relevant for our Ginkgo UTs
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
# - varnamelen # It doesn't seem necessary to enforce a minimum variable name length
- wastedassign
- whitespace
- wrapcheck
- wsl
# - zerologlint # We use zerolog indirectly so this isn't needed
issues:
exclude-rules:
# Separating explicit var declarations by blank lines seems excessive.
Expand Down

0 comments on commit dafd4d6

Please sign in to comment.