Conversation
|
Important Review skippedToo many files! This PR contains 101 files, which is 1 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (8)
📒 Files selected for processing (101)
You can disable this status message by setting the Comment |
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tpantelis The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
c5a7166 to
c42f15d
Compare
| _, found := ovnkubeController.Resources.Requests[resourceName] | ||
| g.Expect(found).To(BeFalse(), "resource request should not be set") | ||
| _, found = ovnkubeController.Resources.Limits[resourceName] | ||
| g.Expect(found).To(BeFalse(), "resource limit should not be set") |
There was a problem hiding this comment.
I disagree with this rewrite in theory, but also tc.mgmtPortResourceName is always non-empty anyway, so just remove the if tc.mgmtPortResourceName != "" part and it's good
There was a problem hiding this comment.
The rewrite saves indentation. There is one case on line 490 where tc.mgmtPortResourceName is empty.
There was a problem hiding this comment.
oh, missed that.
So, I prefer the original (though not enough to want to //nolint it), because it expresses the actual logic better. The rewritten version is not especially explicit about the fact that we only care about tc.mgmtPortResourceName when tc.expectResource is false.
| } | ||
|
|
||
| fmt.Printf("Failed to write ConfigMap: %v", err) | ||
| time.Sleep(10 * time.Second) |
There was a problem hiding this comment.
I don't agree that these rewrites improve the code, though I don't think any of them make it worse either. But if you end up dropping revive entirely (or can configure it to avoid these rewrites specifically), then I'd drop this commit, to save on unnecessary backport conflicts.
There was a problem hiding this comment.
It saves unnecessary indentation which is purely style preference. revive has some opinionated, subjective style rules like this one (superfluous-else) but it also has a lot of useful rules as well that flagged other issues. I think we should keep revive but I disabled superfluous-else (and indent-error-flow).
| { | ||
| name: "RSA PKCS1 private key", | ||
| pemData: func(t *testing.T) []byte { | ||
| t.Helper() |
There was a problem hiding this comment.
This seems wrong; if a test fails inside a helper defined inside a test case, then presumably we want to see that more specific failure location.
There was a problem hiding this comment.
I was on the fence about this linter. I'll ignore it here but I'm also OK with disabling the linter.
There was a problem hiding this comment.
I like how it pointed out when external helper functions were missing t.Helper(). But it seems like a bug to be flagging internal helpers.
|
(overall: yay!) |
c42f15d to
f29cb33
Compare
Adds context.Context parameters to functions throughout the codebase and replaces context.TODO() calls with properly inherited context. This fixes violations reported by the `contextcheck` linter allowing it to be enabled. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
These were flagged by the `dupword` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Replaces type assertions and direct error comparisons with the proper Go 1.13+ error handling functions to correctly handle wrapped errors. This ensures error checking works correctly even when errors are wrapped with additional context. These were flagged by the `errorlint` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Replace non-wrapping format verbs (%v, %s) with %w in fmt.Errorf calls throughout the codebase to ensure proper error wrapping compatible with Go 1.13+ error handling (errors.As, errors.Is). These were flagged by the `errorlint` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Move logs.FlushLogs() from deferred call to explicit call before the error check and os.Exit(). This ensures logs are always flushed before the process exits, since deferred functions do not run when os.Exit() is called. These was flagged by the `gocritic` linter (exitAfterDefer). Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Rename capitalized local variables to follow Go naming conventions. Local variables and function parameters should start with lowercase letters per Go style guidelines. These were flagged by the `gocritic` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Replace nested 'else { if cond {} }' with 'else if cond {}' for
better readability and cleaner code structure.
This was flagged by the `gocritic` linter.
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
...with an if statement for better readability and simpler code structure. A switch with only one case and no default is unnecessarily complex and should be written as a simple if statement. This was flagged by the `gocritic` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Use slices.Clone() when appending to baseClientObjs to avoid potential slice aliasing issues. This ensures each test gets an independent copy of the base objects rather than risking shared underlying arrays. This was flagged by the `gocritic` linter (appendAssign). Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
This was flagged by the `godoclint` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Add nolint directive for plain text response with network addresses. This was flagged by the `gosec` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
f29cb33 to
1ca7e38
Compare
|
@tpantelis: This pull request references CORENET-7399 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
1ca7e38 to
63705b9
Compare
Configure 30-second read and write timeouts to prevent resource exhaustion from slow or malicious clients. This was flagged by the `gosec` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
InsecureSkipVerify is intentional - this tool checks endpoint connectivity, not certificate validity. It needs to connect to arbitrary cluster endpoints with self-signed or internal certificates. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Name unnamed parameters in interfaces for better documentation. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Convert for loops with unused iteration variables to use the range-over-int syntax for clarity and consistency with modern Go patterns. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
This was flagged by the `modernize` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Make the return statement explicit for better code clarity in this 91-line function. Named return parameters document the API; explicit returns remove ambiguity about what's being returned. This was flagged by the `nakedret` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Return the marshal error instead of silently returning nil when json.Marshal fails. This was flagged by the `nilerr` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Replace tls.Conn.Handshake() with HandshakeContext(ctx) and http.NewRequest() with http.NewRequestWithContext() for proper timeout and cancellation support. This was flagged by the `noctx` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
...and eliminate unnecessary intermediate slice variables by returning results directly. These were flagged by the `prealloc` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
This was flagged by the `predeclared` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Add explanatory comments to suppress promlinter warnings about metric naming conventions. While the linter is correct that counters should end with _total and labels should use snake_case, renaming these metrics would be a breaking change for existing monitoring dashboards and alerts. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Change Reconcile method from value receiver to pointer receiver for consistency with other methods and to properly implement the reconcile.Reconciler interface. This was flagged by the `recvcheck` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Either rename them to underscore if they're required in the signature or removing them from function signatures where they are not used. These were flagged by the `revive` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
...according to official Go style guidelines and flagged by the `revive` linter: - don't use ALL_CAPS in Go names; use CamelCase - don't use underscores in Go names Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
None of the contained functions are used anymore. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
...where the type can be inferred from the assigned value. These were flagged by the `revive` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
- Use assert.Equal instead of assert.EqualValues for same-type comparisons - Use require.NoError instead of assert.NoError for error assertions - Use assert.False/assert.True instead of assert.Equal These were flagged by the `testifylint` linter. Signed-off-by: Tom Pantelis <tpantel@redhat.com>
Add t.Helper() calls to test helper functions so errors are reported at the caller's line, not inside the helper function itself. This improves test failure diagnostics and line number accuracy. These were flagged by the `thelper` linter. Signed-off-by: Tom Pantelis <tpantel@redhat.com>
In some cases, all callers pass the same value to a function param and the param can be removed. Similarly with a function that always returns the same value (eg a nil error). These were flagged by the `unparam` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com> # Conflicts: # pkg/controller/proxyconfig/validation.go
This was flagged by the `usestdlibvars` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Clean up whitespace by removing blank lines immediately after opening braces and before closing braces in functions, if statements, for loops, and other code blocks. These were flagged by the `whitespace` linter. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
...to align with recommendations for test readability. - Use BeEmpty() instead of HaveLen(0) for length assertions - Use Expect(err).NotTo(HaveOccurred()) or Expect(...).To(Succeed()) for cleaner error checks These were flagged by the `ginkgolinter` linter. Signed-off-by: Tom Pantelis <tpantel@redhat.com>
Add nolint directive for math/rand usage in serial number generation. This follows the intentional library-go pattern where serial numbers require uniqueness but not cryptographic unpredictability. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Enabled most of the available linters covering code quality, bugs, performance, and style issues. Each linter is documented with its purpose and disabled linters are documented with a reason for exclusion (e.g., high noise-to-signal ratio, overly pedantic rules, or inapplicable to this codebase). Also added exclusion rules to suppress false positives in specific contexts, particularly for test files and subjective style preferences. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
63705b9 to
50c0b13
Compare
|
/retest |
|
@tpantelis: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/test security |
| const MultusValidatingWebhook = "multus.openshift.io" | ||
|
|
||
| // ADDL_TRUST_BUNDLE_CONFIGMAP_NS is the namespace for one or more | ||
| // AdditionalTrustBundleConfigMapNS is the namespace for one or more |
There was a problem hiding this comment.
The "NS" is uglier now that the rest of the name is titlecase... can you change them all to "Namespace"?
| } | ||
|
|
||
| func TestDecodePrivateKey(t *testing.T) { | ||
| //nolint:thelper // Helper functions are inside test cases |
There was a problem hiding this comment.
I had only mentioned this in one place, but there are lots of places where I feel like it was suggesting this incorrectly. Like, every call to testTLSArgRendering (and testTLSArgRendering itself). And I don't like marking each one //nolint, because then the next time someone adds something using testTLSArgRendering, the linter will tell them to use t.Helper(), and the reviewer may not catch the fact that it's wrong.
So we should drop this linter, because it has too many false positives. (And, also, note that the failure mode of someone failing to use t.Helper() where they should is just that unit test error output isn't as helpful as it could have been, and it can always be fixed later.)
(I'm fine keeping the "good" t.Helper() additions if you want, but I haven't gone through every suggestion to figure out which ones would actually make the error output better and which would make it worse, so you'd have to do that.)
Enabled most of the available linters covering code quality, bugs, performance, and style issues. Each linter is documented with its purpose and disabled linters are documented with a reason for exclusion (e.g., high noise-to-signal ratio, overly pedantic rules, or inapplicable to this codebase).
Also added exclusion rules to suppress false positives in specific contexts, particularly for test files and subjective style preferences.
Current violations were addressed in individual commits.