{"id":25869959,"url":"https://github.com/melevir/flake8-functions-names","last_synced_at":"2025-03-02T05:29:21.094Z","repository":{"id":43451639,"uuid":"349808929","full_name":"Melevir/flake8-functions-names","owner":"Melevir","description":"An extension for flake8 that validates functions names, decomposition and conformity with annotations.","archived":false,"fork":false,"pushed_at":"2023-03-13T11:34:19.000Z","size":44,"stargazers_count":27,"open_issues_count":9,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-15T02:34:38.050Z","etag":null,"topics":["code-style","contract","flake8","flake8-plugin","styleguide"],"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/Melevir.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}},"created_at":"2021-03-20T18:46:11.000Z","updated_at":"2023-10-24T10:16:05.000Z","dependencies_parsed_at":"2024-01-06T09:57:49.413Z","dependency_job_id":"4839e97b-cc79-45d3-ba12-53116cd416b5","html_url":"https://github.com/Melevir/flake8-functions-names","commit_stats":{"total_commits":51,"total_committers":7,"mean_commits":7.285714285714286,"dds":"0.17647058823529416","last_synced_commit":"5285edbefcdd48bf3a41cabcd48e845dfae504a0"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melevir%2Fflake8-functions-names","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melevir%2Fflake8-functions-names/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melevir%2Fflake8-functions-names/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melevir%2Fflake8-functions-names/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Melevir","download_url":"https://codeload.github.com/Melevir/flake8-functions-names/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241464996,"owners_count":19967237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["code-style","contract","flake8","flake8-plugin","styleguide"],"created_at":"2025-03-02T05:29:20.439Z","updated_at":"2025-03-02T05:29:21.081Z","avatar_url":"https://github.com/Melevir.png","language":"Python","readme":"# flake8-functions-names\n\n[![PyPI version](https://badge.fury.io/py/flake8-functions-names.svg)](https://badge.fury.io/py/flake8-functions-names)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-functions-names)\n\nAn extension for flake8 that validates functions names, decomposition and\nconformity with annotations. The plugin also has some validations\nof [deal](https://github.com/life4/deal) contracts.\n\nThis plugin helps to provide better naming for functions.\nThe validations are based on my articles:\n\n- [Python functions naming: an algorithm](https://melevir.medium.com/python-functions-naming-the-algorithm-74320a18278d)\n- [Python functions naming: 10 tips](https://melevir.medium.com/python-functions-naming-tips-376f12549f9)\n\n`deal`-related validations are enabled only if `deal` is installed.\nThey are disabled otherwise.\n\n## Installation\n\n```terminal\npip install flake8-functions-names\n```\n\n## Example\n\n```python\ndef is_user_banned(user: User) -\u003e str:\n    return 'is_banned' if user.id in BANNED_USERS else 'not_banned'\n\ndef save_user(user: User) -\u003e None:\n    user.save()\n```\n\nUsage:\n\n```terminal\n$ flake8 test.py\ntext.py:1:35: FNE001 Name of the function says that it should return bool-like, but it returns str\ntext.py:4:4: FNE003 Name of the function uses \"save\", but not uses \"to\"\n```\n\nTested on Python 3.8+ and flake8 3.9+.\n\n## Error codes\n\n| Error code |                     Description          |\n|:----------:|:----------------------------------------:|\n|   FNE001   | Name of the function says that it should return `bool-like`[^1], but it returns *actual_type* |\n|   FNE002   | The method has a `@property` decorator, but has a verb in it's name (*verb*) |\n|   FNE003   | Name of the function uses `save`, but not uses `to` |\n|   FNE004   | Name of the function uses `load`, but not uses `from` |\n|   FNE005   | Return type of the function is `bool-like`[^1], but the name doesn't show it |\n|   FNE006   | Name of function says, that it works with data, so it should be pure, but it has no `@deal.pure()` |\n|   FNE007   | `and` is not recommended in functions names |\n|   FNE008   | Name of functions ends with it's first argument name |\n\n[^1]: bool-like return types: bool, TypeGuard\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelevir%2Fflake8-functions-names","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelevir%2Fflake8-functions-names","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelevir%2Fflake8-functions-names/lists"}