Registry / testing / flake8-return

flake8-return

JSON →
library1.2.0pypypi✓ verified 29d ago

flake8-return is a Flake8 plugin that provides a set of checks related to return values and unnecessary control flow. It aims to improve code readability and eliminate redundant statements. The current version is 1.2.0, with active development and regular releases addressing bug fixes and new checks.

pip install flake8-return
INSTALL
IMPORT
SIG · FLAKE8-RETURN
F
flake8-return
testingpythonv1.2.0
Install
1.6s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Checker
✓ from flake8_return import Checker
✗ from flake8_return import Checker

After installing flake8-return, simply run `flake8` in your project. The plugin will automatically integrate and apply its checks (R5xx codes) to your codebase. You can configure or ignore specific checks using your `pyproject.toml`, `setup.cfg`, or `.flake8` file.

# 1. Install Flake8 (if not already installed) pip install flake8 # 2. Install flake8-return pip install flake8-return # 3. Run Flake8 in your project directory # flake8 will automatically discover and load flake8-return flake8 .
Debug
Known issues
breakingVersion 1.2.0 introduced new checks (R505, R506, R507, R508) ported from Pylint (no-else-break, no-else-continue, no-else-raise, no-else-return). These will likely flag new warnings in existing codebases that previously passed linting.
fix
Review newly reported R505-R508 warnings and refactor code to eliminate unnecessary `else` statements or explicitly ignore these specific error codes in your Flake8 configuration if desired.
affects: >=1.2.0
gotchaThe R504 check ('Unnecessary assignment') has undergone multiple fixes and refinements across versions (e.g., v1.1.2, v1.2.0). This means its behavior, including false positives or negatives, might have changed, leading to different linting results for the same code across versions.
fix
Ensure you are on the latest version of `flake8-return` for the most accurate R504 detection. If you encounter issues, review the code or consider temporarily ignoring R504 if the warning is deemed incorrect for your specific use case.
affects: <1.2.0
gotchaThe R503 check ('Unnecessary else statement') can be opinionated. While often promoting cleaner code, some developers prefer explicit `else` blocks for certain control flow patterns, leading to desired code being flagged.
fix
If the R503 warning clashes with your team's coding style or is considered a false positive for a specific case, you can disable this check in your Flake8 configuration (e.g., `ignore = R503` in `pyproject.toml`).
affects: all
Upgrade
Version history
1.2.0latest on PyPI · released Oct 28, 2022
Audit
Dependencies
flake8requiredThis package is a plugin for Flake8; Flake8 must be installed and run for these checks to be applied.
Agent activity
12 hits · last 30 days
node
10
Resources
flake8-return — pip install flake8-return · libregistry