nunnatsa / ginkgolinter

golang linter for ginkgo and gomega
MIT License
24 stars 6 forks source link

Add new linter rule: avoid comparison assersion #65

Closed nunnatsa closed 1 year ago

nunnatsa commented 1 year ago

Description

A worng comparison is a boolean comparison using ==',!=,>,>=,<or<=`, and assertion of a boolean value.

Examples:

Expect(x == 10).Should(BeTrue()) ==> Expect(x).Should(Equal(10))

Expect(s != "testing").Should(Equal(true)) ==> Expect(s).ShouldNot(Equal("testing"))

Expect(x > 10).To(BeTrue()) ==> Expect(x).To(BeNumerically(">", 10))

Added a new executable's flag to suppress this new rule: --suppress-compare-assertion=true

Fixes #64

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Checklist:

@pohly

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 4279981495


Changes Missing Coverage Covered Lines Changed/Added Lines %
types/config.go 6 7 85.71%
ginkgo_linter.go 121 143 84.62%
<!-- Total: 132 155 85.16% -->
Files with Coverage Reduction New Missed Lines %
ginkgo_linter.go 1 88.06%
types/config.go 1 32.43%
<!-- Total: 2 -->
Totals Coverage Status
Change from base Build 4223637700: -1.6%
Covered Lines: 635
Relevant Lines: 733

💛 - Coveralls
nunnatsa commented 1 year ago

@pohly - would you mind to take a look on this PR?