Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes suggested by staticcheck #4289

Merged
merged 1 commit into from
Jul 8, 2019

Conversation

aledbf
Copy link
Member

@aledbf aledbf commented Jul 8, 2019

What this PR does / why we need it:

staticcheck k8s.io/ingress-nginx/internal/...
internal/ingress/annotations/ipwhitelist/main.go:49:2: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008)
internal/ingress/annotations/ratelimit/main.go:99:2: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008)
internal/ingress/controller/config/config.go:93:19: unknown JSON option "squash" (SA5008)
internal/ingress/controller/controller_test.go:54:7: const fakeCertificateName is unused (U1000)
internal/ingress/controller/nginx.go:386:4: ineffective break statement. Did you mean to break out of the outer loop? (SA4011)
internal/ingress/controller/nginx.go:550:40: calling math.Ceil on a converted integer is pointless (SA4015)
internal/ingress/controller/nginx.go:1093:27: should use tmplBuf.String() instead of string(tmplBuf.Bytes()) (S1030)
internal/ingress/controller/store/backend_ssl.go:124:12: should omit nil check; len() for nil slices is defined as zero (S1009)
internal/ingress/controller/store/backend_ssl_test.go:35:6: type MockQueue is unused (U1000)
internal/ingress/controller/store/backend_ssl_test.go:56:6: func buildSimpleClientSetForBackendSSL is unused (U1000)
internal/ingress/controller/store/backend_ssl_test.go:60:6: func buildIngListenerForBackendSSL is unused (U1000)
internal/ingress/controller/store/backend_ssl_test.go:66:6: func buildSecretForBackendSSL is unused (U1000)
internal/ingress/controller/store/backend_ssl_test.go:75:6: func buildSecrListerForBackendSSL is unused (U1000)
internal/ingress/controller/store/backend_ssl_test.go:90:6: func buildControllerForBackendSSL is unused (U1000)
internal/ingress/controller/store/backend_ssl_test.go:114:6: func buildCrtKeyAndCA is unused (U1000)
internal/ingress/controller/store/store.go:169:33: error strings should not be capitalized (ST1005)
internal/ingress/controller/store/store.go:183:33: error strings should not be capitalized (ST1005)
internal/ingress/controller/store/store_test.go:1175:5: should use !bytes.Equal(m1, m2) instead (S1004)
internal/ingress/controller/tcp.go:100:36: printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006)
internal/ingress/controller/tcp.go:127:2: should use a simple channel send/receive instead of select with a single case (S1000)
internal/ingress/defaults/main.go:32:25: unknown JSON option "-" (SA5008)
internal/ingress/defaults/main.go:105:29: unknown JSON option "-" (SA5008)
internal/ingress/defaults/main.go:137:32: unknown JSON option "-" (SA5008)
internal/ingress/metric/collectors/testutils.go:73:20: error strings should not end with punctuation or a newline (ST1005)
internal/ingress/types_equals.go:142:2: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008)
internal/ingress/types_equals.go:478:2: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008)
internal/ingress/types_equals.go:531:2: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008)
internal/net/ssl/ssl.go:187:6: func isSSLCertStoredOnDisk is unused (U1000)
internal/net/ssl/ssl_test.go:346:6: func encodePublicKeyPEM is unused (U1000)
internal/nginx/main.go:101:24: error strings should not be capitalized (ST1005)
internal/nginx/main.go:107:24: error strings should not be capitalized (ST1005)


staticcheck k8s.io/ingress-nginx/cmd/...
cmd/dbg/main.go:136:14: should use prettyBuffer.String() instead of string(prettyBuffer.Bytes()) (S1030)
cmd/dbg/main.go:231:14: should use prettyBuffer.String() instead of string(prettyBuffer.Bytes()) (S1030)
cmd/nginx/flags.go:205:32: error strings should not be capitalized (ST1005)
cmd/nginx/flags.go:209:32: error strings should not be capitalized (ST1005)
cmd/nginx/flags.go:213:32: error strings should not be capitalized (ST1005)
cmd/nginx/flags.go:217:32: error strings should not be capitalized (ST1005)
cmd/nginx/flags.go:225:32: error strings should not be capitalized (ST1005)
cmd/nginx/main_test.go:92:3: redundant return statement (S1023)
cmd/plugin/commands/backends/backends.go:83:13: printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006)
cmd/plugin/lints/ingress.go:151:4: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008)
cmd/plugin/lints/ingress.go:151:7: should use strings.Contains(val, "satisfy") instead (S1003)
cmd/plugin/request/request.go:56:32: error strings should not be capitalized (ST1005)
cmd/plugin/request/request.go:67:33: error strings should not be capitalized (ST1005)
cmd/plugin/request/request.go:195:2: should write allEndpoints := endpointsCache[""] instead of allEndpoints, _ := endpointsCache[""] (S1005)
cmd/plugin/request/request.go:225:36: error strings should not be capitalized (ST1005)
cmd/plugin/util/util.go:48:6: func printWithError is unused (U1000)
cmd/plugin/util/util.go:55:6: func printOrError is unused (U1000)
cmd/plugin/util/util.go:68:29: error strings should not be capitalized (ST1005)

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:

@aledbf aledbf added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jul 8, 2019
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 8, 2019
@k8s-ci-robot k8s-ci-robot requested review from bowei and ElvinEfendi July 8, 2019 20:19
})
}
}
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this test completely deleted?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the test was commented and the helpers unused. Also, the tests were related to static mode.

@ElvinEfendi
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 8, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aledbf, ElvinEfendi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 771fc9f into kubernetes:master Jul 8, 2019
@aledbf aledbf deleted the static-check branch August 29, 2019 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants