Skip to content

Commit c5d2bba

Browse files
committed
Add missing comments in internal parse util
1 parent 25328c5 commit c5d2bba

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

cmd/internal/codegen/parse/util.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
// IsAPIResource returns true if t has a +resource/+kubebuilder:resource comment tag
3030
func IsAPIResource(t *types.Type) bool {
3131
for _, c := range t.CommentLines {
32-
if strings.Contains(c, "+resource") || strings.Contains(c, "+kubebuilder:resource"){
32+
if strings.Contains(c, "+resource") || strings.Contains(c, "+kubebuilder:resource") {
3333
return true
3434
}
3535
}
@@ -57,6 +57,7 @@ func IsNonNamespaced(t *types.Type) bool {
5757
return false
5858
}
5959

60+
// IsController returns true if t has a +controller or +kubebuilder:controller tag
6061
func IsController(t *types.Type) bool {
6162
for _, c := range t.CommentLines {
6263
if strings.Contains(c, "+controller") || strings.Contains(c, "+kubebuilder:controller") {
@@ -66,6 +67,7 @@ func IsController(t *types.Type) bool {
6667
return false
6768
}
6869

70+
// IsRBAC returns true if t has a +rbac or +kubebuilder:rbac tag
6971
func IsRBAC(t *types.Type) bool {
7072
for _, c := range t.CommentLines {
7173
if strings.Contains(c, "+rbac") || strings.Contains(c, "+kubebuilder:rbac") {
@@ -75,16 +77,16 @@ func IsRBAC(t *types.Type) bool {
7577
return false
7678
}
7779

80+
// IsInformer returns true if t has a +informers or +kubebuilder:informers tag
7881
func IsInformer(t *types.Type) bool {
79-
for _, c := range t.CommentLines {
80-
if strings.Contains(c, "+informers") || strings.Contains(c, "+kubebuilder:informers") {
81-
return true
82-
}
83-
}
84-
return false
82+
for _, c := range t.CommentLines {
83+
if strings.Contains(c, "+informers") || strings.Contains(c, "+kubebuilder:informers") {
84+
return true
85+
}
86+
}
87+
return false
8588
}
8689

87-
8890
// IsAPISubresource returns true if t has a +subresource-request comment tag
8991
func IsAPISubresource(t *types.Type) bool {
9092
for _, c := range t.CommentLines {
@@ -162,6 +164,7 @@ func (c Comments) getTag(name, sep string) string {
162164
return ""
163165
}
164166

167+
// hasTag returns true if the Comments has a tag with the given name
165168
func (c Comments) hasTag(name string) bool {
166169
for _, c := range c {
167170
prefix := fmt.Sprintf("+%s", name)

0 commit comments

Comments
 (0)