no-assignment-and-return

A flake8 extension that checks for assignment and return in Python
A Flake8 lint based on Clippy's
let_and_return
and Microsoft's TSLint lint
no-unnecessary-local-variable.
For more info on the structure of this lint, see the accompanying blog post.
examples
# error
def foo():
x = bar()
return x
# allowed
def foo():
x, _ = bar()
return x
see: flake8_assign_and_return.py for all the test cases
dev
# install dependencies
poetry install
# install plugin to work with flake8
poetry run python setup.py install
# test
poetry run pytest
# or with watch
poetry run ptw
# typecheck
poetry run mypy *.py
# format
poetry run black .
# lint
poetry run flake8 .
uploading a new version to PyPi
# increment `__version__` and pyproject.toml `version`
# build new distribution files
rm -rf dist && poetry run python setup.py sdist bdist_wheel
# upload to pypi (Note: this will ask for login credentials)
poetry run twine upload dist/*
Release files for flake8-assign-and-return 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flake8-assign-and-return-0.0.4.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_assign_and_return-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.8 kB
Release files / flake8-assign-and-return-0.0.4.tar.gz
| Download URL | flake8-assign-and-return-0.0.4.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ffd1cc6c21b0a786c44b445d188b646b3f17b33c2fe49649a5bd2ff735610721
|
|
BLAKE2b-256 checksum How to use checksums |
119d9ae41189edfd9758b96e46d8a3c53aa2348c35992ced6ef4d87cfac00fb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
|
Release files / flake8_assign_and_return-0.0.4-py3-none-any.whl
| Download URL | flake8_assign_and_return-0.0.4-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
959fbcad1737cb68d4be96547a40d9b15e6501a29286b37509b9e73f3d387002
|
|
BLAKE2b-256 checksum How to use checksums |
b9027797c07976e548d65fe4aeaf32074f10603258a519fb9c61ea517021ac6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
|