golangci-lint: exclude naming convention check for swagger docs

This started to show up now as linter hints at the start of the 1.34 cycle in
all PRs which modify the API. We don't want to enforce that convention in that
generated code, so suppressing it.
This commit is contained in:
Patrick Ohly
2025-07-06 16:54:04 +02:00
parent 0fe23942fd
commit b22ffdb48f
3 changed files with 18 additions and 0 deletions

View File

@@ -102,6 +102,12 @@ linters:
- revive
text: "(ST1003: should not use underscores in Go names; func ([cC]onvert_.*_To_.*|[sS]etDefaults_)|exported: exported function (Convert|SetDefaults)_.* should be of the form)"
# The generated swagger docs also don't follow the naming convention.
- linters:
- staticcheck
text: "ST1003: should not use underscores in Go names"
path: types_swagger_doc_generated.go$
- path: (.+)\.go$
# staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore
text: ineffective break statement. Did you mean to break out of the outer loop

View File

@@ -102,6 +102,12 @@ linters:
- revive
text: "(ST1003: should not use underscores in Go names; func ([cC]onvert_.*_To_.*|[sS]etDefaults_)|exported: exported function (Convert|SetDefaults)_.* should be of the form)"
# The generated swagger docs also don't follow the naming convention.
- linters:
- staticcheck
text: "ST1003: should not use underscores in Go names"
path: types_swagger_doc_generated.go$
# TODO(https://github.com/kubernetes/kubernetes/issues/131475): Remove these excluded directories and fix findings. Due to large amount of findings in different components
# with different owners it's hard to fix everything in a single pr. This will therefore be done in multiple prs.
- path: (pkg/volume/*|test/*|azure/*|pkg/cmd/wait*|request/bearertoken/*|metrics/*|filters/*)

View File

@@ -102,6 +102,12 @@ linters:
- revive
text: "(ST1003: should not use underscores in Go names; func ([cC]onvert_.*_To_.*|[sS]etDefaults_)|exported: exported function (Convert|SetDefaults)_.* should be of the form)"
# The generated swagger docs also don't follow the naming convention.
- linters:
- staticcheck
text: "ST1003: should not use underscores in Go names"
path: types_swagger_doc_generated.go$
{{- if .Hints}}
- path: (.+)\.go$