Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty: support positive len #139

Closed
ccoVeille opened this issue Jun 20, 2024 · 4 comments
Closed

empty: support positive len #139

ccoVeille opened this issue Jun 20, 2024 · 4 comments
Labels
duplicate This issue or pull request already exists

Comments

@ccoVeille
Copy link
Contributor

ccoVeille commented Jun 20, 2024

this pattern is common

var arr []string
assert.True(t, 0 < len(arr))

https://github.com/search?q=language%3Ago+%22assert.True%28t%2C+0+%3C+len%28%22&type=code

compares checker will fix it to

var arr []string
assert.Positive(t, len(l))

But that's it, while we should convert it to Empty

assert.NotEmpty(t, l)

It's a new use case

Originally posted by @ccoVeille in #119 (comment)

@ccoVeille
Copy link
Contributor Author

Please confirm if the logic is valid for you, then I can code it

@ccoVeille ccoVeille changed the title negative-positive: support len empty: support positive len Jun 20, 2024
@ccoVeille
Copy link
Contributor Author

Well this one could be added to #119 maybe, not sure if we have to do it at the same time or separately

@Antonboom
Copy link
Owner

But this one won't be detected

Do you check it before spam issue?

Duplicate of #122
Implemented in #124

@Antonboom Antonboom closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2024
@Antonboom Antonboom added the duplicate This issue or pull request already exists label Jun 21, 2024
@ccoVeille
Copy link
Contributor Author

I did check locally, but apparently I failed to find it.

I checked twice, once with testifylint binary, but I didn't build it recently 🤦

Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants