{"id":5228,"library":"flake8-return","title":"Flake8 Return Plugin","description":"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.","status":"active","version":"1.2.0","language":"en","source_language":"en","source_url":"https://github.com/afonasev/flake8-return","tags":["flake8","linter","static analysis","code quality","return statements","unnecessary else"],"install":[{"cmd":"pip install flake8-return","lang":"bash","label":"Install"}],"dependencies":[{"reason":"This package is a plugin for Flake8; Flake8 must be installed and run for these checks to be applied.","package":"flake8","optional":false}],"imports":[{"note":"Flake8 plugins are typically loaded automatically via entry points. Direct import of the Checker class is generally not needed for regular use, but shown here for completeness of the package structure.","symbol":"Checker","correct":"from flake8_return.checker import Checker"}],"quickstart":{"code":"# 1. Install Flake8 (if not already installed)\npip install flake8\n\n# 2. Install flake8-return\npip install flake8-return\n\n# 3. Run Flake8 in your project directory\n# flake8 will automatically discover and load flake8-return\nflake8 .","lang":"bash","description":"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."},"warnings":[{"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.","message":"Version 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.","severity":"breaking","affected_versions":">=1.2.0"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":"<1.2.0"},{"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`).","message":"The 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.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}