diff --git a/hack/golangci-hints.yaml b/hack/golangci-hints.yaml index 54ffefcddbc..8306b7be5a1 100644 --- a/hack/golangci-hints.yaml +++ b/hack/golangci-hints.yaml @@ -91,6 +91,17 @@ linters: text: should not use Add, use AddVersioned instead path: _test.go$ + # 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_*. + # + # https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507028627 + # https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1514201592 + - linters: + - staticcheck + - 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)" + - 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 diff --git a/hack/golangci.yaml b/hack/golangci.yaml index ecdb29b5800..bc9c4bf9e72 100644 --- a/hack/golangci.yaml +++ b/hack/golangci.yaml @@ -91,6 +91,17 @@ linters: text: should not use Add, use AddVersioned instead path: _test.go$ + # 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_*. + # + # https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507028627 + # https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1514201592 + - linters: + - staticcheck + - 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)" + # 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/*) diff --git a/hack/golangci.yaml.in b/hack/golangci.yaml.in index 30490288ff8..570aafdc239 100644 --- a/hack/golangci.yaml.in +++ b/hack/golangci.yaml.in @@ -91,6 +91,17 @@ linters: text: should not use Add, use AddVersioned instead path: _test.go$ + # 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_*. + # + # https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507028627 + # https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1514201592 + - linters: + - staticcheck + - 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)" + {{- if .Hints}} - path: (.+)\.go$