flake8-functions-names
An extension for flake8 that validates functions names, decomposition and conformity with annotations. The plugin also has some validations of deal contracts.
This plugin helps to provide better naming for functions. The validations are based on my articles:
deal-related validations are enabled only if deal is installed.
They are disabled otherwise.
Installation
pip install flake8-functions-names
Example
def is_user_banned(user: User) -> str:
return 'is_banned' if user.id in BANNED_USERS else 'not_banned'
def save_user(user: User) -> None:
user.save()
Usage:
$ flake8 test.py
text.py:1:35: FNE001 Name of the function says that it should return bool-like, but it returns str
text.py:4:4: FNE003 Name of the function uses "save", but not uses "to"
Tested on Python 3.8+ and flake8 3.9+.
Error codes
| Error code | Description |
|---|---|
| FNE001 | Name of the function says that it should return bool-like1, but it returns actual_type |
| FNE002 | The method has a @property decorator, but has a verb in it's name (verb) |
| FNE003 | Name of the function uses save, but not uses to |
| FNE004 | Name of the function uses load, but not uses from |
| FNE005 | Return type of the function is bool-like1, but the name doesn't show it |
| FNE006 | Name of function says, that it works with data, so it should be pure, but it has no @deal.pure() |
| FNE007 | and is not recommended in functions names |
| FNE008 | Name of functions ends with it's first argument name |
Metadata
Release files for flake8-functions-names 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flake8_functions_names-0.4.0.tar.gz | 10.1 kB | Without provenance | Details for flake8_functions_names-0.4.0.tar.gz |
Release files / flake8_functions_names-0.4.0.tar.gz
| Download URL | flake8_functions_names-0.4.0.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27aeb881636680a130f609482c1d0f37d1b2e84a76b20b813d079c888ee0a13e
|
|
BLAKE2b-256 checksum How to use checksums |
b2c1e5f0e511f1426cd26959813e94254314e5163b6eff78c47b5c09f66641d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.1
|
Security for flake8-functions-names 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.