Flake8 plugin that checks return values
Project description
flake8-return
Flake8 plugin that checks return values.
Installation
pip install flake8-return
Errors
- R501 you shouldn`t add None at any return if function havn`t return value except None
def x(y):
if not y:
return
return None # error!
- R502 you should add explicit value at every return if function have return value except None
def x(y):
if not y:
return # error!
return 1
- R503 you should add explicit return at end of the function if function have return value except None
def x(y):
if not y:
return # error!
return 1
- R504 you shouldn`t assign value to variable if it will be use only as return value
def x():
a = 1
# some code that not using `a`
print('test')
return a # error!
Returns in asyncio coroutines also supported.
License
MIT
Change Log
0.3.0 - 2019.02.26
- 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 suppport asyncio coroutines
0.2.0 - 2019.02.21
- 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
0.1.1 - 2019.02.10
- fix error messages
0.1.0 - 2019.02.10
- initial
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flake8-return-0.3.0.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for flake8_return-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70fe3b925c784fb4f1147e4de8a3026954c15e5971b751468d2ec11deb3ba629 |
|
MD5 | 81b64bb3e18ebca6937e0921aa7ab058 |
|
BLAKE2b-256 | 33c2c0026d70d52b7f5222014c6585df4f434185cb0e40d56eb2ab477a4ecb17 |