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

len+compare: false-positive on assert.True(t, len(myarray) > 0) #122

Closed
mmorel-35 opened this issue Jun 11, 2024 · 1 comment · Fixed by #124
Closed

len+compare: false-positive on assert.True(t, len(myarray) > 0) #122

mmorel-35 opened this issue Jun 11, 2024 · 1 comment · Fixed by #124
Labels
false-positive Checker's false positive example

Comments

@mmorel-35
Copy link

mmorel-35 commented Jun 11, 2024

With assert.True(t, len(myarray) > 0), it is replaced by assert.Positive(t, len(myarray)) with compare rule
I would then expect len or empty rule to suggest
assert.NotEmpty(t, myarray)

Same logic with assert.True(t, len(myarray) >= 1) is replaced by assert.GreaterOrEqual(t, len(myarray), 1), shall then be assert.NotEmpty(t, myarray)

@mmorel-35 mmorel-35 changed the title len+compare: false-positive on assert.True(t, len(array) > 0) len+compare: false-positive on assert.True(t, len(myarray) > 0) Jun 11, 2024
@Antonboom Antonboom added the false-positive Checker's false positive example label Jun 11, 2024
@mmorel-35
Copy link
Author

mmorel-35 commented Jun 14, 2024

I left GreaterOrEqual 1 unmodified in #124 because of the comment about readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-positive Checker's false positive example
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants