v0.9.0
This new version brings some new additions:
New Linter Rules
HaveLen()
matcher with a value of 0 (HaveLen(0)
), will trigger a warning that will suggest to replace this matcher withBeEmpty()
.- Assertion of a comparison and a boolean matcher will trigger a warning that will suggest to use the a better matcher, like
BeEqual()
For example:
Expect(x == 1).To(BeTrue()) // ===> Expect(x).To(Equal(1))
Expect(x == 0).To(Equal(false)) // ===> Expect(x).ToNot(BeZero())
Expect(x > y).To(BeTrue()) // ===> Expect(x).To(BeNumerically(">", y))
and so on.
New Executable's flags
--allow-havelen-0=true
: if this flag is set, the linter won't trigger warnings forHaveLen(0)
--suppress-compare-assertion=true
: if this flag is set, the linter won't trigger warnings for wrong boolean comparisons.
New suppress comment
Adding the // ginkgo-linter:ignore-compare-assert-warning
comment, will suppress the wrong comparison warning for a specific file or line. See more details at the README.md file