Skip to content

Commit 83f6990

Browse files
committed
lint: nolint refactor targets
Signed-off-by: Stephen Augustus <[email protected]>
1 parent 6f691eb commit 83f6990

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

pkg/kepctl/create.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ func updateTemplate(t *api.Proposal, opts *CreateOpts) {
121121
}
122122

123123
t.OwningSIG = opts.SIG
124+
125+
// TODO(lint): appendAssign: append result not assigned to the same slice (gocritic)
126+
//nolint:gocritic
124127
t.ParticipatingSIGs = append(opts.SIGS, opts.SIG)
125128
t.Filename = opts.Name
126129
t.LastUpdated = "v1.19"

pkg/kepctl/kepctl.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ func findLocalKEPMeta(repoPath, sig string) ([]string, error) {
178178
"keps",
179179
sig)
180180

181+
// TODO(lint): importShadow: shadow of imported from 'k8s.io/enhancements/pkg/kepval/keps' package 'keps' (gocritic)
182+
//nolint:gocritic
181183
keps := []string{}
182184

183185
// if the sig doesn't have a dir, it has no KEPs

pkg/kepval/keps/validations/yaml.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ var (
3333
reMilestone = regexp.MustCompile(`v1\\.[1-9][0-9]*`)
3434
)
3535

36+
// TODO(lint): cyclomatic complexity 50 of func `ValidateStructure` is high (> 30) (gocyclo)
37+
//nolint:gocyclo
3638
func ValidateStructure(parsed map[interface{}]interface{}) error {
3739
for _, key := range mandatoryKeys {
3840
if _, found := parsed[key]; !found {
@@ -54,6 +56,8 @@ func ValidateStructure(parsed map[interface{}]interface{}) error {
5456
// figure out the types
5557
switch strings.ToLower(k) {
5658
case "status":
59+
// TODO(lint): singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
60+
//nolint:gocritic
5761
switch v := value.(type) {
5862
case []interface{}:
5963
return util.NewValueMustBeString(k, v)
@@ -67,6 +71,8 @@ func ValidateStructure(parsed map[interface{}]interface{}) error {
6771
}
6872

6973
case "stage":
74+
// TODO(lint): singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
75+
//nolint:gocritic
7076
switch v := value.(type) {
7177
case []interface{}:
7278
return util.NewValueMustBeString(k, v)
@@ -80,6 +86,8 @@ func ValidateStructure(parsed map[interface{}]interface{}) error {
8086
}
8187

8288
case "owning-sig":
89+
// TODO(lint): singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
90+
//nolint:gocritic
8391
switch v := value.(type) {
8492
case []interface{}:
8593
return util.NewValueMustBeString(k, v)
@@ -102,6 +110,8 @@ func ValidateStructure(parsed map[interface{}]interface{}) error {
102110
fallthrough
103111

104112
case "title", "creation-date", "last-updated":
113+
// TODO(lint): singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
114+
//nolint:gocritic
105115
switch v := value.(type) {
106116
case []interface{}:
107117
return util.NewValueMustBeString(k, v)
@@ -181,6 +191,8 @@ func ValidateStructure(parsed map[interface{}]interface{}) error {
181191
}
182192

183193
case "latest-milestone":
194+
// TODO(lint): singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
195+
//nolint:gocritic
184196
switch v := value.(type) {
185197
case []interface{}:
186198
return util.NewValueMustBeString(k, v)
@@ -217,6 +229,8 @@ func validateMilestone(parsed map[interface{}]interface{}) error {
217229
return util.NewKeyMustBeString(k)
218230
}
219231

232+
// TODO(lint): singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
233+
//nolint:gocritic
220234
switch strings.ToLower(k) {
221235
case "alpha", "beta", "stable":
222236
switch v := value.(type) {

pkg/kepval/keps/validations/yaml_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import (
2424
"gopkg.in/yaml.v2"
2525
)
2626

27-
// TODO: Fix field keys and flow flags
27+
// TODO(lint): Fix field keys and flow flags
28+
//nolint:govet
2829
type proposal struct {
2930
Title string `yaml:"title"`
3031
Authors []string `yaml:,flow`

pkg/kepval/prrs/validations/yaml.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,12 @@ func validateMilestone(parsed map[interface{}]interface{}) error {
6969
}
7070

7171
// figure out the types
72+
// TODO(lint): singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
73+
//nolint:gocritic
7274
switch strings.ToLower(k) {
7375
case "approver":
76+
// TODO(lint): singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
77+
//nolint:gocritic
7478
switch v := value.(type) {
7579
case []interface{}:
7680
return util.NewValueMustBeString(k, v)

0 commit comments

Comments
 (0)