Toggle table of contents sidebar
no-else-return / R1705ΒΆMessage emitted:
Unnecessary "%s" after "return", %s
Description:
Used in order to highlight an unnecessary block of code following an if containing a return statement. As such, it will warn when it encounters an else following a chain of ifs, all of them containing a return statement.
Problematic code:
def compare_numbers(a: int, b: int) -> int: if a == b: # [no-else-return] return 0 elif a < b: return -1 else: return 1
Correct code:
def compare_numbers(a: int, b: int) -> int: if a == b: return 0 if a < b: return -1 return 1
Created by the refactoring checker.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4