Open heavenshell opened 1 year ago
The R505 rule was ported from pylint as suggested in #14.
As plyint also throws an error in this case, I do not believe this is a false positive.
src/a.py:2:4: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
I see the same behavior within classes using the 1.2.0 version.
def foo(name):
[...]
return True
def bar(name):
if "foo" == "bar": <----
return 'baz'
The if statement in bar
gets flagged with an R505
because of the return
in foo.
I encountered a similar issue e.g:
if op == Op.EQUAL:
return left_value == right_value
elif op == Op.NOT_EQUAL:
return left_value != right_value
I deactivated R505
because of too many false positives.
Description
Invalid error reported for R505 simple if - elif pattern
What I Did
I think this pattern should be passed.