{"id":13733926,"url":"https://github.com/afonasev/flake8-return","last_synced_at":"2026-01-14T15:24:09.369Z","repository":{"id":35559478,"uuid":"169781561","full_name":"afonasev/flake8-return","owner":"afonasev","description":"Flake8 plugin for return expressions checking.","archived":false,"fork":false,"pushed_at":"2024-05-04T21:53:15.000Z","size":187,"stargazers_count":62,"open_issues_count":14,"forks_count":66,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-01T16:12:52.075Z","etag":null,"topics":["flake8-plugin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/afonasev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-08T18:38:15.000Z","updated_at":"2025-08-01T22:48:25.000Z","dependencies_parsed_at":"2024-01-06T09:55:21.058Z","dependency_job_id":"ba0d89e3-8842-4b00-8563-e8c36b1b1f18","html_url":"https://github.com/afonasev/flake8-return","commit_stats":{"total_commits":128,"total_committers":9,"mean_commits":"14.222222222222221","dds":0.5078125,"last_synced_commit":"646a00912834755b56e2b0e0c9c57f10271b2829"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/afonasev/flake8-return","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afonasev%2Fflake8-return","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afonasev%2Fflake8-return/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afonasev%2Fflake8-return/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afonasev%2Fflake8-return/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afonasev","download_url":"https://codeload.github.com/afonasev/flake8-return/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afonasev%2Fflake8-return/sbom","scorecard":{"id":169862,"data":{"date":"2025-08-11","repo":{"name":"github.com/afonasev/flake8-return","commit":"646a00912834755b56e2b0e0c9c57f10271b2829"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":4,"reason":"Found 9/21 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29","Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28","Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/lint_python.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/afonasev/flake8-return/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/afonasev/flake8-return/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/afonasev/flake8-return/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/afonasev/flake8-return/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint_python.yml:7: update your workflow using https://app.stepsecurity.io/secureworkflow/afonasev/flake8-return/lint_python.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint_python.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/afonasev/flake8-return/lint_python.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/lint_python.yml:12","Warn: pipCommand not pinned by hash: .github/workflows/lint_python.yml:13","Warn: pipCommand not pinned by hash: .github/workflows/lint_python.yml:20","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"12 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2024-48 / GHSA-fj7x-q9j7-g6q6","Warn: Project is vulnerable to: PYSEC-2024-4 / GHSA-2mqj-m65w-jghx","Warn: Project is vulnerable to: PYSEC-2023-165 / GHSA-cwvm-v4w8-q58c","Warn: Project is vulnerable to: PYSEC-2022-42992 / GHSA-hcpj-qp55-gfph","Warn: Project is vulnerable to: PYSEC-2023-137 / GHSA-pr76-5cm5-w9cj","Warn: Project is vulnerable to: PYSEC-2023-161 / GHSA-wfm5-v35h-vwf4","Warn: Project is vulnerable to: PYSEC-2022-42969","Warn: Project is vulnerable to: PYSEC-2021-142 / GHSA-8q59-q68h-6hv4","Warn: Project is vulnerable to: PYSEC-2025-49 / GHSA-5rjg-fvgr-3xxf","Warn: Project is vulnerable to: GHSA-cx63-2mw6-8hw5","Warn: Project is vulnerable to: PYSEC-2022-43012 / GHSA-r9hx-vwmv-q579","Warn: Project is vulnerable to: GHSA-jfmj-5v4g-7637"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T16:08:07.521Z","repository_id":35559478,"created_at":"2025-08-16T16:08:07.521Z","updated_at":"2025-08-16T16:08:07.521Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28424347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flake8-plugin"],"created_at":"2024-08-03T03:00:50.969Z","updated_at":"2026-01-14T15:24:09.346Z","avatar_url":"https://github.com/afonasev.png","language":"Python","readme":"# flake8-return\n\n[![pypi](https://badge.fury.io/py/flake8-return.svg)](https://pypi.org/project/flake8-return)\n[![Python: 3.6+](https://img.shields.io/badge/Python-3.6+-blue.svg)](https://pypi.org/project/flake8-return)\n[![Downloads](https://img.shields.io/pypi/dm/flake8-return.svg)](https://pypistats.org/packages/flake8-return)\n[![Build Status](https://travis-ci.org/Afonasev/flake8-return.svg?branch=master)](https://travis-ci.org/Afonasev/flake8-return)\n[![Code coverage](https://codecov.io/gh/afonasev/flake8-return/branch/master/graph/badge.svg)](https://codecov.io/gh/afonasev/flake8-return)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://en.wikipedia.org/wiki/MIT_License)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\nFlake8 plugin that checks return values. \nFlake8-return rule set is supported in [ruff](https://github.com/charliermarsh/ruff#flake8-return).\n\n## Installation\n\n```bash\npip install flake8-return\n```\n\n## Errors\n\n* R501 do not explicitly return None in function if it is the only possible return value.\n\n```python\ndef x(y):\n    if not y:\n        return\n    return None  # error!\n```\n\n* R502 do not implicitly return None in function able to return non-None value.\n\n```python\ndef x(y):\n    if not y:\n        return  # error!\n    return 1\n```\n\n* R503 missing explicit return at the end of function able to return non-None value.\n\n```python\ndef x(y):\n    if not y:\n        return 1\n    # error!\n```\n\n* R504 unnecessary variable assignment before return statement.\n\n```python\ndef x():\n    a = 1\n    # some code that not using `a`\n    print('test')\n    return a  # error!\n```\n\n* R505 unnecessary else after return statement.\n\n```python\ndef x(y, z):\n    if y:  # error!\n        return 1\n    else:\n        return z\n```\n\n* R506 unnecessary else after raise statement.\n\n```python\ndef x(y, z):\n    if y:  # error!\n        raise Exception(y)\n    else:\n        raise Exception(z)\n```\n\n* R507 unnecessary else after continue statement.\n\n```python\ndef x(y, z):\n    for i in y:\n        if i \u003c z:  # error!\n            continue\n        else:\n            a = 0\n```\n\n* R508 unnecessary else after break statement.\n\n```python\ndef x(y, z):\n    for i in y:\n        if i \u003e z:  # error!\n            break\n        else:\n            a = 0\n```\n\nReturns in asyncio coroutines also supported.\n\n## For developers\n\n### Show help\n\n    make help\n\n### Create venv and install deps\n\n    make init\n\n### Install git precommit hook\n\n    make precommit\n\n### Run linters, autoformat, tests etc\n\n    make pretty lint test\n\n### Bump new version\n\n    make bump_major\n    make bump_minor\n    make bump_patch\n\n## Change Log\n\nUnreleased\n-----\n\n* ...\n\n1.2.0 - 2022-10-28\n-----\n\n* Port no-else-break, no-else-continue, no-else-raise, no-else-return from pylint (#122) Calum Young\n* PEP 621: Migrate more config to pyproject.toml (#123) Christian Clauss\n* Fix/116/R504-try-except (#120) Calum Young\n* Update ci (#119) Calum Young\n* Fix/47/Update-R504-for-assignment-value (#117) Calum Young\n* Upgrade GitHub Actions (#113) Christian Clauss\n* Add a space to avoid a typo in R503 (#98) Christian Clauss\n* GitHub Action to lint Python code (#97) Christian Clauss\n* Typo fixes (#92) Aarni Koskela\n* Create codeql-analysis.yml Afonasev Evgeniy\n* Bump flake8-plugin-utils from 1.1.1 to 1.3.2 (#87) dependabot\n* Bump mypy from 0.812 to 0.971 (#114) dependabot\n* Bump pytest-cov from 3.0.0 to 4.0.0 (#124) dependabot\n* Bump pytest-cov from 2.11.1 to 3.0.0 (#102) dependabot\n* Bump pytest-mock from 3.6.0 to 3.6.1 (#91) dependabot\n* Bump pytest from 6.2.4 to 6.2.5 (#99) dependabot\n* Bump pylint from 2.8.2 to 2.10.2 (#100) dependabot\n* Bump pytest from 6.2.3 to 6.2.4 (#86) dependabot\n\n1.1.3 - 2021-05-05\n-----\n\n* Error clarifications (#77) Clément Robert\n* fix linting (migrate to black 20.0b1) (#78) Clément Robert\n\n1.1.2 - 2020-07-09\n-----\n\n* Make R504 visitors handle while loops (#56) Frank Tackitt\n* Rename allows-prereleases to allow-prereleases (#55) Frank Tackitt\n* Fix typo: → haven't (#24) Jon Dufresne\n\n1.1.1 - 2019-09-21\n-----\n\n* fixed [#3](https://github.com/afonasev/flake8-return/issues/3) The R504 doesn't detect that the variable is modified in loop\n* fixed [#4](https://github.com/afonasev/flake8-return/issues/4) False positive with R503 inside async with clause\n\n1.1.0 - 2019-05-23\n-----\n\n* update flask_plugin_utils version to 1.0\n\n1.0.0 - 2019-05-13\n-----\n\n* skip assign after unpacking while unnecessary assign checking \"(x, y = my_obj)\"\n\n0.3.2 - 2019-04-01\n-----\n\n* allow \"assert False\" as last function return\n\n0.3.1 - 2019-03-11\n-----\n\n* add pypi deploy into travis config\n* add make bump_version command\n\n0.3.0 - 2019-02-26\n-----\n\n* skip functions that consist only `return None`\n* fix false positive when last return inner with statement\n* add unnecessary assign error\n* add support tuple in assign or return expressions\n* add support asyncio coroutines\n\n0.2.0 - 2019-02-21\n-----\n\n* fix explicit/implicit\n* add flake8-plugin-utils as dependency\n* allow raise as last function return\n* allow no return as last line in while block\n* fix if/elif/else cases\n\n0.1.1 - 2019-02-10\n-----\n\n* fix error messages\n\n0.1.0 - 2019-02-10\n-----\n\n* initial\n","funding_links":[],"categories":["Clean code"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafonasev%2Fflake8-return","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafonasev%2Fflake8-return","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafonasev%2Fflake8-return/lists"}