Closed ccoVeille closed 5 months ago
Please, do not use Empty
for objects for which len
is not applicable.
For me these are Zero
cases and use Empty
is not best and doubtful option here.
That's right. As you declined the idea of a zero checker, I assumed you didn't want to suggest using zero.
BTW, I just found out these cannot be part of empty
checker, as nothing detects this now
a := 17
assert.Equal(t, 0, a)
So I'm unsure where to add it
here are some other use cases
assert.Equal(t, int(0), zkr.cache.NumAdTemplates)
As you declined the idea of a zero checker, I assumed you didn't want to suggest using zero.
Yes, we are in a stalemate – I have nothing against zero
that concentrated on zero objects only, how I mentioned before – https://github.com/Antonboom/testifylint/issues/75#issuecomment-2067582114. But I do not want introduce any complex matrix solutions spread across checkecks
So, let's just ignore assert.Equal(t, 0, a)
and similar
This pattern should be detected
Example: https://github.com/ipfs-force-community/go-fvm-sdk/blob/d49236897af1fdb5e0f7d29573fcbe1d29e2214d/sdk/cases/send.go#L40-L41
The following code should be suggested
This pattern is currently not detected, while it's pretty commonly used https://github.com/search?q=language%3Ago+%22assert.Equal%28t%2C+0%2C+int%22&type=code