Skip to main content

A flake8 extension that checks for assignment and return in Python

Project description

no-assignment-and-return CircleCI pypi

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.


# error
def foo():
   x = bar()
   return x

# allowed
def foo():
   x, _ = bar()
   return x

see: for all the test cases


# install dependencies
poetry install

# install plugin to work with flake8
poetry run python 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 sdist bdist_wheel

# upload to pypi (Note: this will ask for login credentials)
poetry run twine upload dist/*

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for flake8-assign-and-return, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size flake8_assign_and_return-0.0.4-py3-none-any.whl (3.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size flake8-assign-and-return-0.0.4.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page