From c72526cd9c185eee8ad24aa37edd16c64abefee9 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 27 Mar 2025 12:13:28 -0700 Subject: [PATCH] .golangci.yml: switch to list of enabled linters Instead of enabling all linters, and when disabling some of them because we don't like them, switch to list of explicitly enabled linters. The upside of this is we can easily upgrade golangci-lint (i.e. any new linters won't break our CI). The downside is, we need to explicitly enable extra linters. To me, this is better from the maintainability perspective. NOTE this commit does not change the configuration in any way, in other words, the list of linters being run is the same as before. The next commit will address this. Signed-off-by: Kir Kolyshkin --- .codespellrc | 2 +- .golangci.yml | 117 +++++++++++++++++++++++++------------------------- 2 files changed, 60 insertions(+), 59 deletions(-) diff --git a/.codespellrc b/.codespellrc index d701e173c4..2a26666eb4 100644 --- a/.codespellrc +++ b/.codespellrc @@ -3,4 +3,4 @@ skip = bin,vendor,.git,go.sum,.cirrus.yml,"*.fish,RELEASE_NOTES.md,*.xz,*.gz,*.ps1,*.tar,swagger.yaml,*.tgz,bin2img,*ico,*.png,*.1,*.5,copyimg,*.orig,apidoc.go check-hidden = true ignore-regex = \b(Not|assert)In\b -ignore-words-list = ddress,secon,passt,bu,hastable,te,clos,ans,pullrequest,uint,iff,od,seeked,splitted,marge,erro,hist,ether,specif,whit +ignore-words-list = ddress,secon,passt,bu,hastable,te,clos,ans,pullrequest,uint,iff,od,seeked,splitted,marge,erro,hist,ether,specif,whit,decorder diff --git a/.golangci.yml b/.golangci.yml index cc02747583..c421694fd5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,64 +4,65 @@ run: timeout: 5m modules-download-mode: readonly linters: - enable-all: true - disable: - # too many reports but requires attention - - depguard - - intrange # should be turned on but we have to convert each place manually as there is no auto fix function - - tagalign - - perfsprint - - typecheck - # useful hints that should be addressed - - testifylint # all of reports that should be fixed - - nakedret - - gosmopolitan # usage of time.Local in pkg/k8s.io - - tagliatelle # too many JSON keys cannot be changed due to compat - - dupword # too many false positives (e.g., in tests) - - gocognit - - testpackage - - err113 - - errorlint - - wrapcheck - - paralleltest - - wsl - - godox - - tparallel - - nlreturn - - noctx - - nestif - - predeclared - - thelper - - forbidigo - - exhaustive - - gofumpt - - gci - - godot - - dupl - - funlen - - gochecknoglobals - - gochecknoinits - - goconst - - gocyclo - - lll - - gosec - - musttag # way to many warnings to fix for now, also some false positives - - mnd # way to many false positives - - gomoddirectives - - containedctx - - contextcheck - - cyclop - - canonicalheader # our current header values are fixed and should not be changed - - errname - - forcetypeassert - - ireturn - - varnamelen - - maintidx - - nilnil - - nonamedreturns - - exhaustruct - # deprecated linters - - tenv + enable: + - asasalint + - asciicheck + - bidichk + - bodyclose + - copyloopvar + - decorder + - dogsled + - durationcheck + - errcheck + - errchkjson + - exptostd + - fatcontext + - ginkgolinter + - gocheckcompilerdirectives + - gochecksumtype + - gocritic + - gofmt + - goheader + - goimports + - gomodguard + - goprintffuncname + - gosimple + - govet + - grouper + - iface + - importas + - inamedparam + - ineffassign + - interfacebloat + - loggercheck + - makezero + - mirror + - misspell + - nilerr + - nilnesserr + - nolintlint + - nosprintfhostport + - prealloc + - promlinter + - protogetter + - reassign + - recvcheck + - revive + - rowserrcheck + - sloglint + - spancheck + - sqlclosecheck + - staticcheck + - stylecheck + - testableexamples + - unconvert + - unparam + - unused + - usestdlibvars + - usetesting + - wastedassign + - whitespace + - zerologlint linters-settings: errcheck: check-blank: false