Skip to content
This repository was archived by the owner on Aug 12, 2024. It is now read-only.

Adds ginkgolinter#637

Merged
m1kola merged 1 commit into
operator-framework:mainfrom
m1kola:ginkgolinter
Jun 15, 2023
Merged

Adds ginkgolinter#637
m1kola merged 1 commit into
operator-framework:mainfrom
m1kola:ginkgolinter

Conversation

@m1kola
Copy link
Copy Markdown
Member

@m1kola m1kola commented Jun 14, 2023

Linter which checks for common ginkgo issues like wrong error assertions (Expect(err).To(BeNil()) instead of Expect(err).NotTo(HaveOccurred())), etc.

It also identifies Expect calls without a matcher. For example, we have 3 such instances in this repo:

test/e2e/rukpakctl_test.go:243:4       ginkgolinter  ginkgo-linter: "Expect": missing assertion method. Expected "Should()", "To()", "ShouldNot()", "ToNot()" or "NotTo()"
internal/storage/storage_test.go:64:3  ginkgolinter  ginkgo-linter: "Expect": missing assertion method. Expected "Should()", "To()", "ShouldNot()", "ToNot()" or "NotTo()"
internal/storage/storage_test.go:69:3  ginkgolinter  ginkgo-linter: "Expect": missing assertion method. Expected "Should()", "To()", "ShouldNot()", "ToNot()" or "NotTo()"

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 14, 2023
@m1kola m1kola force-pushed the ginkgolinter branch 3 times, most recently from ce4a9a6 to 12b2292 Compare June 15, 2023 10:42
Comment on lines -242 to -244
It("output error message", func() {
Expect(strings.Contains(output, "content command failed") &&
strings.Contains(output, "bundles.core.rukpak.io \"a\" not found"))
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

output (stdout) was empty becasue rukpak logs errors into stderr. So boolean expression was evaluating into false. Since there was no matcher - this was testing nothing.

Good linter 🐶

Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
@m1kola m1kola marked this pull request as ready for review June 15, 2023 14:22
@m1kola m1kola requested a review from a team as a code owner June 15, 2023 14:22
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 15, 2023
@m1kola m1kola merged commit a16ba23 into operator-framework:main Jun 15, 2023
@m1kola m1kola deleted the ginkgolinter branch June 15, 2023 15:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants