
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.
53 lines
1.6 KiB
YAML
53 lines
1.6 KiB
YAML
# This file configures checks that all new code for Kubernetes is meant to
|
|
# pass, in contrast to .golangci.yaml which defines checks that also the
|
|
# existing code passes.
|
|
|
|
run:
|
|
timeout: 30m
|
|
skip-files:
|
|
- "^zz_generated.*"
|
|
|
|
issues:
|
|
max-same-issues: 0
|
|
# Excluding configuration per-path, per-linter, per-text and per-source
|
|
exclude-rules:
|
|
# exclude ineffassign linter for generated files for conversion
|
|
- path: conversion\.go
|
|
linters:
|
|
- ineffassign
|
|
# The Kubernetes naming convention for conversion functions uses underscores
|
|
# and intentionally deviates from normal Go conventions to make those function
|
|
# names more readable. Same for SetDefaults_*.
|
|
- 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
|
|
enable: # please keep this alphabetized and in sync with golangci.yaml
|
|
- ginkgolinter
|
|
- gocritic
|
|
- govet
|
|
- ineffassign
|
|
- logcheck
|
|
- staticcheck
|
|
- stylecheck
|
|
- unused
|
|
|
|
linters-settings: # please keep this alphabetized
|
|
custom:
|
|
logcheck:
|
|
# Installed there by hack/verify-golangci-lint.sh.
|
|
path: ../_output/local/bin/logcheck.so
|
|
description: structured logging checker
|
|
original-url: k8s.io/logtools/logcheck
|
|
gocritic:
|
|
staticcheck:
|
|
checks:
|
|
- "all"
|
|
stylecheck:
|