Flake8 plugin that checks return values
Likely abandoned. No release or commit for years (last release over 4 years ago).
$
pip install flake8-returnflake8-return
Flake8 plugin that checks return values.
Installation
pip install flake8-return
Errors
- R501 do not explicitly return None in function if it is the only possible return value.
def x(y):
if not y:
return
return None # error!
- R502 do not implicitly return None in function able to return non-None value.
def x(y):
if not y:
return # error!
return 1
- R503 missing explicit return at the end of function able to return non-None value.
def x(y):
if not y:
return 1
# error!
- R504 unnecessary variable assignment before return statement.
def x():
a = 1
# some code that not using `a`
print('test')
return a # error!
- R505 unnecessary else after return statement.
def x(y, z):
if y: # error!
return 1
else:
return z
- R506 unnecessary else after raise statement.