Skip to content

Commit 9e84a02

Browse files
authored
Merge pull request kubernetes#121672 from pohly/golangci-lint-comment-check-fix
golangci-lint: tone down comment checking
2 parents 9747358 + 248100c commit 9e84a02

File tree

4 files changed

+40
-18
lines changed

4 files changed

+40
-18
lines changed

hack/golangci-hints.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ issues:
6767
- gocritic
6868
text: "ifElseChain: rewrite if-else to switch statement"
6969

70+
# Only packages listed here opt into the strict "exported symbols must be documented".
71+
#
72+
# Exclude texts from https://github.com/golangci/golangci-lint/blob/ab3c3cd69e602ff53bb4c3e2c188f0caeb80305d/pkg/config/issues.go#L11-L103
73+
- linters:
74+
- golint
75+
- revive
76+
- stylecheck
77+
text: comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form|comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form|exported (.+) should have comment( \(or a comment on this block\))? or be unexported|package comment should be of the form "(.+)...|comment on exported (.+) should be of the form "(.+)...|should have a package comment
78+
path-except: cmd/kubeadm
79+
7080
linters:
7181
disable-all: false
7282
enable: # please keep this alphabetized

hack/golangci-strict.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ issues:
6767
- gocritic
6868
text: "ifElseChain: rewrite if-else to switch statement"
6969

70+
# Only packages listed here opt into the strict "exported symbols must be documented".
71+
#
72+
# Exclude texts from https://github.com/golangci/golangci-lint/blob/ab3c3cd69e602ff53bb4c3e2c188f0caeb80305d/pkg/config/issues.go#L11-L103
73+
- linters:
74+
- golint
75+
- revive
76+
- stylecheck
77+
text: comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form|comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form|exported (.+) should have comment( \(or a comment on this block\))? or be unexported|package comment should be of the form "(.+)...|comment on exported (.+) should be of the form "(.+)...|should have a package comment
78+
path-except: cmd/kubeadm
79+
7080
# The following issues were deemed "might be worth fixing, needs to be
7181
# decided on a case-by-case basis". This was initially decided by a
7282
# majority of the developers who voted in
@@ -93,12 +103,6 @@ issues:
93103
- gosimple
94104
text: "S1033: unnecessary guard around call to delete"
95105

96-
# Only packages listed here opt into the strict "exported symbols must be documented".
97-
- linters:
98-
- revive
99-
text: "(exported: exported .* or be unexported|exported: comment on exported.*should be of the form)"
100-
path-except: cmd/kubeadm
101-
102106
# Didn't make it into https://github.com/kubernetes/kubernetes/issues/117288.
103107
# Discussion on Slack concluded that "it's hard to have a universal policy for all
104108
# functions marked deprecated" and thus this can only be a hint which must

hack/golangci.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ issues:
7373
- gocritic
7474
text: "ifElseChain: rewrite if-else to switch statement"
7575

76+
# Only packages listed here opt into the strict "exported symbols must be documented".
77+
#
78+
# Exclude texts from https://github.com/golangci/golangci-lint/blob/ab3c3cd69e602ff53bb4c3e2c188f0caeb80305d/pkg/config/issues.go#L11-L103
79+
- linters:
80+
- golint
81+
- revive
82+
- stylecheck
83+
text: comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form|comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form|exported (.+) should have comment( \(or a comment on this block\))? or be unexported|package comment should be of the form "(.+)...|comment on exported (.+) should be of the form "(.+)...|should have a package comment
84+
path-except: cmd/kubeadm
85+
7686
# The following issues were deemed "might be worth fixing, needs to be
7787
# decided on a case-by-case basis". This was initially decided by a
7888
# majority of the developers who voted in
@@ -99,12 +109,6 @@ issues:
99109
- gosimple
100110
text: "S1033: unnecessary guard around call to delete"
101111

102-
# Only packages listed here opt into the strict "exported symbols must be documented".
103-
- linters:
104-
- revive
105-
text: "(exported: exported .* or be unexported|exported: comment on exported.*should be of the form)"
106-
path-except: cmd/kubeadm
107-
108112
# Didn't make it into https://github.com/kubernetes/kubernetes/issues/117288.
109113
# Discussion on Slack concluded that "it's hard to have a universal policy for all
110114
# functions marked deprecated" and thus this can only be a hint which must

hack/golangci.yaml.in

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ issues:
7676
- gocritic
7777
text: "ifElseChain: rewrite if-else to switch statement"
7878

79+
# Only packages listed here opt into the strict "exported symbols must be documented".
80+
#
81+
# Exclude texts from https://github.com/golangci/golangci-lint/blob/ab3c3cd69e602ff53bb4c3e2c188f0caeb80305d/pkg/config/issues.go#L11-L103
82+
- linters:
83+
- golint
84+
- revive
85+
- stylecheck
86+
text: comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form|comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form|exported (.+) should have comment( \(or a comment on this block\))? or be unexported|package comment should be of the form "(.+)...|comment on exported (.+) should be of the form "(.+)...|should have a package comment
87+
path-except: cmd/kubeadm
88+
7989
{{- if not .Hints}}
8090

8191
# The following issues were deemed "might be worth fixing, needs to be
@@ -104,12 +114,6 @@ issues:
104114
- gosimple
105115
text: "S1033: unnecessary guard around call to delete"
106116

107-
# Only packages listed here opt into the strict "exported symbols must be documented".
108-
- linters:
109-
- revive
110-
text: "(exported: exported .* or be unexported|exported: comment on exported.*should be of the form)"
111-
path-except: cmd/kubeadm
112-
113117
# Didn't make it into https://github.com/kubernetes/kubernetes/issues/117288.
114118
# Discussion on Slack concluded that "it's hard to have a universal policy for all
115119
# functions marked deprecated" and thus this can only be a hint which must

0 commit comments

Comments
 (0)