Flake8 plugin that checks return values.
pip install flake8-return
- 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!
Returns in asyncio coroutines also supported.
make help
make init
make precommit
make pretty lint test
make bump_major
make bump_minor
make bump_patch
- ...
- Error clarifications (#77) Clément Robert
- fix linting (migrate to black 20.0b1) (#78) Clément Robert
- Make R504 visitors handle while loops (#56) Frank Tackitt
- Rename allows-prereleases to allow-prereleases (#55) Frank Tackitt
- Fix typo: → haven't (#24) Jon Dufresne
- fixed #3 The R504 doesn't detect that the variable is modified in loop
- fixed #4 False positive with R503 inside async with clause
- update flask_plugin_utils version to 1.0
- skip assign after unpacking while unnecessary assign checking "(x, y = my_obj)"
- allow "assert False" as last function return
- add pypi deploy into travis config
- add make bump_version command
- skip functions that consist only
return None
- fix false positive when last return inner with statement
- add unnecessary assign error
- add support tuple in assign or return expressions
- add support asyncio coroutines
- fix explicit/implicit
- add flake8-plugin-utils as dependency
- allow raise as last function return
- allow no return as last line in while block
- fix if/elif/else cases
- fix error messages
- initial