blob: be133ba8730be8bcff4ecf3e629725c947d2f2df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
"""Check for logical tautology, when a value is compared against itself."""
# pylint: disable=missing-docstring, disallowed-name, singleton-comparison, too-many-return-statements, inconsistent-return-statements, no-else-return, too-many-branches, literal-comparison
def foo():
arg = 786
if arg == arg: # [comparison-with-itself]
return True
elif arg != arg: # [comparison-with-itself]
return True
elif arg > arg: # [comparison-with-itself]
return True
elif arg <= arg: # [comparison-with-itself]
return True
elif None == None: # [comparison-with-itself]
return None
elif 786 == 786: # [comparison-with-itself]
return True
elif 786 is 786: # [comparison-with-itself]
return True
elif 786 is not 786: # [comparison-with-itself]
return True
elif arg is arg: # [comparison-with-itself]
return True
elif arg is not arg: # [comparison-with-itself]
return True
elif True is True: # [comparison-with-itself]
return True
elif 666 == 786:
return False
else:
return None
def bar():
arg = 666
return 666 if arg != arg else 786 # [comparison-with-itself]
def foobar():
arg = 786
return arg > 786
|