Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions vulnerable-file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ruleid:useless-eqeq
x == x
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This expression is always True: x == x or x != x. If testing for floating point NaN, use math.isnan(x), or cmath.isnan(x) if the number is complex. (Line 2)

⚪️ This finding does not block your pull request.
🙈 From python.lang.correctness.useless-eqeq.useless-eqeq.


def __eq__(self, other):
# OK; skip most things that are inside eqs based on what we saw on platform
return self == self and self == other

def sure(ofcourse):
return 1 == 1

class A:
def __eq__(self, other):
# OK; skip most things that are inside eqs based on what we saw on platform
return self == self and self == other


assert(x == x)
assert x == x
assert x == x, "of course"
assertTrue(x ==x)
assertFalse(x == x)