flake8-return
Flake8 plugin that checks return values
Decision gist · record as of 2026-08-14
Yes, if you use flake8 and want to enforce return statement consistency. The plugin is low-friction to install, has no known vulnerabilities, and covers a useful gap in standard flake8 checks. The aging maintenance status is a minor concern—last release was 2022-10-28—but the repository remains active and the plugin's scope is narrow enough that it is unlikely to break with minor Python or flake8 updates. Install it if your team values clean return patterns; skip it if you already enforce these rules through code review or a different linter.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires flake8 to be installed and configured; the plugin integrates into flake8's linting pipeline and does not work standalone.
- Low friction installation with a single lightweight runtime dependency.
- The package is aging—last release was 2022-10-28—but the repository remains active with recent commits and no archived status, suggesting maintenance continues despite infrequent version bumps.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.
last release 2022-10-28 (1386 days) · last repo commit 2025-10-08 · 60 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 603,124 downloads/mo, #5,812 on PyPI
Alternatives
Verify before relying
pip install flake8-return
# Then run flake8 on your code; the plugin activates automatically
flake8 your_file.py
# Example: this will trigger R501
def example(x):
if not x:
return
return None- Whether the aging maintenance status (last release 2022-10-28, 1386 days ago) affects compatibility with recent Python or flake8 versions.
- Performance impact on large codebases or whether there are known false positives beyond those documented in the changelog.
What it is and what it does
flake8-return is a flake8 plugin that enforces consistent and clean return statement patterns in Python code. It detects eight categories of return-related issues: explicit None returns when unnecessary, implicit None returns in functions that can return non-None values, missing explicit returns at function end, unnecessary variable assignments before returns, and redundant else blocks after return, raise, continue, or break statements. The plugin also supports asyncio coroutines.
You install it alongside flake8, and it runs automatically during linting without requiring separate configuration. It flags violations with error codes R501 through R508, each targeting a specific anti-pattern. The plugin depends on flake8-plugin-utils for its implementation and works with Python versions from 3.6 onward.
Use it for
- Enforce consistent return behavior across a codebase to catch functions that sometimes return None implicitly and sometimes explicitly.
- Simplify control flow by detecting and removing unnecessary else blocks after return or raise statements.
- Catch unnecessary intermediate variable assignments that serve no purpose before a return.
- Ensure all code paths in a function that can return a value have an explicit return statement.
- Maintain code style consistency in teams by automatically flagging return-related anti-patterns during CI/CD linting.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you use flake8 and want to enforce return statement consistency.
The plugin is low-friction to install, has no known vulnerabilities, and covers a useful gap in standard flake8 checks. The aging maintenance status is a minor concern—last release was 2022-10-28—but the repository remains active and the plugin's scope is narrow enough that it is unlikely to break with minor Python or flake8 updates. Install it if your team values clean return patterns; skip it if you already enforce these rules through code review or a different linter.
Install
flake8-return on PyPI
Before you install
Low friction installation with a single lightweight runtime dependency. The package is aging—last release was 2022-10-28—but the repository remains active with recent commits and no archived status, suggesting maintenance continues despite infrequent version bumps.
Requires flake8 to be installed and configured; the plugin integrates into flake8's linting pipeline and does not work standalone.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install flake8-return
# Then run flake8 on your code; the plugin activates automatically
flake8 your_file.py
# Example: this will trigger R501
def example(x):
if not x:
return
return None
Verify before relying
- Whether the aging maintenance status (last release 2022-10-28, 1386 days ago) affects compatibility with recent Python or flake8 versions.
- Performance impact on large codebases or whether there are known false positives beyond those documented in the changelog.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.6,<4.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageflake8-plugin-utils |
| Maintenance | Aging 1,386 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 603,124 / month, #5,812 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: flake8_return-1.2.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “flake8 return value linting”
- flake8-returnA flake8 plugin that detects and flags problematic return statement…
- flake8-annotationsA Flake8 plugin that enforces PEP 3107-style function type…
- flake8-functionsA flake8 extension that enforces function-level code quality rules:…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also flake8-pie · flake8-plugin-utils · flake8-pytest-style · flake8-unused-arguments · flake8-comprehensions · flake8-print · flake8-noqa · flake8-implicit-str-concat · flake8_simplify · flake8-tidy-imports