From 1af54256969582301ecc7ba81a6574133372e60e Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 27 Jun 2023 14:12:28 +0200 Subject: [PATCH] hack: disable gomega.Consistently/Eventually check due to false positives For example, this is a false positive that currently exists in the code base: test/e2e_node/dra_test.go:129:4: ginkgo-linter: use a function call in Consistently. This actually checks nothing, because Consistently receives the function returned value, instead of function itself, and this value is never changed; consider using `gomega.Consistently(ctx, e2epod.Get).WithArguments(f.ClientSet, pod).WithTimeout(podInPendingStateTimeout).Should(e2epod.BeInPhase(v1.PodPending), "Pod should be in Pending state as resource preparation time outed")` instead (ginkgolinter) gomega.Consistently(ctx, e2epod.Get(f.ClientSet, pod)).WithTimeout(podInPendingStateTimeout).Should(e2epod.BeInPhase(v1.PodPending), ^ It's a false positive because e2epod.Get returns the function that Consistently is meant to call. This could be worked around by assigning e2epod.Get(f.ClientSet, pod) to a variable and then use that variable, but that is less readable. --- hack/golangci-strict.yaml | 4 ++++ hack/golangci.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/hack/golangci-strict.yaml b/hack/golangci-strict.yaml index b54a11f3b40..c5aa8399c04 100644 --- a/hack/golangci-strict.yaml +++ b/hack/golangci-strict.yaml @@ -21,6 +21,10 @@ issues: - linters: - stylecheck text: "ST1003: should not use underscores in Go names; func (Convert_.*_To_.*|SetDefaults_)" + # This check currently has some false positives (https://github.com/nunnatsa/ginkgolinter/issues/91). + - linters: + - ginkgolinter + text: use a function call in (Eventually|Consistently) linters: disable-all: false # in contrast to golangci.yaml, the default set of linters remains enabled diff --git a/hack/golangci.yaml b/hack/golangci.yaml index 280037377bf..f29986b714a 100644 --- a/hack/golangci.yaml +++ b/hack/golangci.yaml @@ -22,6 +22,10 @@ issues: - linters: - stylecheck text: "ST1003: should not use underscores in Go names; func (Convert_.*_To_.*|SetDefaults_)" + # This check currently has some false positives (https://github.com/nunnatsa/ginkgolinter/issues/91). + - linters: + - ginkgolinter + text: use a function call in (Eventually|Consistently) linters: disable-all: true # not disabled in golangci-strict.yaml