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

Enable ginkgolinter and fix findings #126

Merged
merged 3 commits into from
Jan 10, 2024

Commits on Jan 10, 2024

  1. Enable ginkgolinter and fix findings

    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>
    nunnatsa committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    d10a665 View commit details
    Browse the repository at this point in the history
  2. Fix the assertMetrics test helper function

    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>
    nunnatsa committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    f93ce10 View commit details
    Browse the repository at this point in the history
  3. Simplify error check in tests

    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>
    nunnatsa committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    b85b9e7 View commit details
    Browse the repository at this point in the history