-
Notifications
You must be signed in to change notification settings - Fork 40
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
Enable ginkgolinter and fix findings #126
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #126 +/- ##
=======================================
Coverage 81.03% 81.03%
=======================================
Files 17 17
Lines 485 485
=======================================
Hits 393 393
Misses 82 82
Partials 10 10 ☔ View full report in Codecov by Sentry. |
Yes, it does, thanks |
ginkgolinter finds bugs and enforces standards of using the ginkgo and gomega packages. See more details here: https://github.com/nunnatsa/ginkgolinter This PR enables the ginkgolinter in the .golangci.yml, and fixes all the new finding from running golangci-lint. Note: all the finding were auto fixed by running the ginkgolinter cli with the `-fix` flag. Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
The assertMetrics function in handler/instrumented_enqueue_object_test.go, wasn't really doing anything. The switch-case compared a pointer value to another pointer, so the no case was actually ever selected, because the addresses were not the same. Tested with a debugger - no value were ever selected. This commit fixes this test by selecting the value rather than the address. Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
Replace this patter: ```golang err := someFuncRetOnlyErr() Expect(err).ToNot(HaveOccurred() ``` With ```golang Expect(someFuncRetOnlyErr()).To(Succeed()) ``` Also, use the `MatchError` gomega matcher when checking errors. Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
1c4df46
to
b85b9e7
Compare
Thanks @ncdc. Done. |
Thanks, I'm afk for a bit, but will review when I'm back today |
ncdc
approved these changes
Jan 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the change
ginkgolinter finds bugs and enforces standards of using the ginkgo and gomega packages. See more details here:
https://github.com/nunnatsa/ginkgolinter
This PR enables the ginkgolinter in the .golangci.yml, and fixes all the new finding from running golangci-lint. It also sorts the enabled linter names for better readability.
Note: all the finding were auto fixed by running the ginkgolinter cli with the
-fix
flag.While going over the changes, found several more issues:
First, the
assertMetrics
function in handler/instrumented_enqueue_object_test.go, wasn't really doing anything. The switch-case compared a pointer value to another pointer, so the no case was actually ever selected, because the addresses were not the same.This PR also fixes that issue.
Then, this PR also improve the error handling in tests in two ways:
Replace this pattern:
With
Also, use the
MatchError
gomega matcher when checking errors.