From 4c4ffeb02214577a55c0f7b8df53abbba3bb2b1e Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 26 Feb 2025 15:52:08 +0100 Subject: [PATCH] golangci-lint: temporarily suppress known issues in the code base These suppressions are necessary to make golangci-lint 1.64 pass with the current code base. This change is meant to be backported to release branches. On master, we may want to revert some of it together with fixing the findings. --- hack/golangci.yaml | 18 ++++++++++++++++++ hack/golangci.yaml.in | 21 +++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/hack/golangci.yaml b/hack/golangci.yaml index 1b37f9f60fd..87817ff761e 100644 --- a/hack/golangci.yaml +++ b/hack/golangci.yaml @@ -69,6 +69,24 @@ issues: - ginkgolinter text: use a function call in (Eventually|Consistently) + # Some of these seem legitimate, maybe better fix code (https://github.com/kubernetes/kubernetes/issues/130449). + + - linters: + - govet + text: "lostcancel|printf" + + - linters: + - ginkgolinter + text: "wrong error assertion. Consider using `gomega.(Eventually|Consistently)|wrong comparison assertion|wrong length assertion" + + - linters: + - testifylint + text: "encoded-compare|error-nil|formatter" + + - linters: + - gocritic + text: "append result not assigned to the same slice|put a space between `//` and comment text|sloppyLen|elseif|should rewrite switch statement to if statement|regexpMust|wrapperFunc: use strings.ReplaceAll|singleCaseSwitch|deprecatedComment|exitAfterDefer|captLocal|unlambda|underef|unslice|valSwap|typeSwitchVar" + # https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507012435 - linters: - gocritic diff --git a/hack/golangci.yaml.in b/hack/golangci.yaml.in index 47736a324f6..2f738f8e755 100644 --- a/hack/golangci.yaml.in +++ b/hack/golangci.yaml.in @@ -72,6 +72,27 @@ issues: - ginkgolinter text: use a function call in (Eventually|Consistently) + {{- if .Base}} + + # Some of these seem legitimate, maybe better fix code (https://github.com/kubernetes/kubernetes/issues/130449). + + - linters: + - govet + text: "lostcancel|printf" + + - linters: + - ginkgolinter + text: "wrong error assertion. Consider using `gomega.(Eventually|Consistently)|wrong comparison assertion|wrong length assertion" + + - linters: + - testifylint + text: "encoded-compare|error-nil|formatter" + + - linters: + - gocritic + text: "append result not assigned to the same slice|put a space between `//` and comment text|sloppyLen|elseif|should rewrite switch statement to if statement|regexpMust|wrapperFunc: use strings.ReplaceAll|singleCaseSwitch|deprecatedComment|exitAfterDefer|captLocal|unlambda|underef|unslice|valSwap|typeSwitchVar" + {{- end}} + # https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507012435 - linters: - gocritic