nunnatsa / ginkgolinter

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

[Enhancement] BeEqual("") -> BeEmpty() #108

Closed pohly closed 9 months ago

pohly commented 9 months ago

Is your feature request related to a problem? Please describe.

Instead of BeEqual("") it would be better to use BeEmpty(). It supports strings and makes the intent and failure message clearer.

Additional context

https://github.com/kubernetes/kubernetes/pull/120403#pullrequestreview-1623915358

pohly commented 9 months ago

I've not checked whether this is already supported - at least the version in the latest golangci-lint doesn't seem to have it.

nunnatsa commented 9 months ago

Hi @pohly, thanks for this idea. I think many developers will find go Equal("") better readable than BeEmpty().

It like in a regular go condition, that many developers prefer

if s == ""

Over

if len(s) == 0

This is why I'm not sure about it. Do you want to open a discussion in the ginkgo slack channel?

pohly commented 9 months ago

Yes, let's do that.

pohly commented 9 months ago

This proposal is too contentious, let's not do it.