Flake8 plugin for enforcing kwargs only argument definition.
Project description
flake8-enforce-kwargs
Overview
flake8-enforce-kwargs is a Flake8 plugin designed to enforce the use of keyword arguments in functions and class methods. This plugin helps promote code clarity and readability by encouraging the explicit naming of arguments, making it easier for developers to understand the purpose of each parameter.
Installation
To install the flake8-enforce-kwargs plugin, use the following pip command:
pip install flake8-enforce-kwargs
Usage
After installation, runs automatically when you run the flake8 command. For example:
flake8 your_project_directory
This will check your Python files for functions and class methods that do not use keyword arguments. Any violations of the rule will be reported in the Flake8 output.
Configuration
The plugin can be configured using the Flake8 configuration file (usually setup.cfg or .flake8). Add the following section to enable and configure the flake8-enforce-kwargs plugin:
Additionally, you can customize the behavior of the plugin by adjusting the following optional settings:
- exclude: A list of names or patterns for functions or methods to exclude from the keyword argument check.
Example configuration:
per-file-ignores =
utils.py:EKW002,EKW001
Rules
The flake8-enforce-kwargs plugin enforces the following rules:
All arguments in functions and class methods must use keyword arguments.
Example
pythonCopy code
# This function violates the rule
def add(x, y):
return x + y
# This class method violates the rule
class Calculator:
def multiply(self, a, b):
return a * b
In the example above, the add function and the multiply method violate the keyword argument rule. Running Flake8 with the flake8-enforce-kwargs plugin will report these violations.
License
flake8-enforce-kwargs is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flake8-enforce-kwargs-0.1.1.tar.gz.
File metadata
- Download URL: flake8-enforce-kwargs-0.1.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86da0506458dab98575e85531fa5cc16b54e87e9cb5c4b83783264bf74c1b71e
|
|
| MD5 |
7e442ef6c3c63e13d8a0c3abf2d3e344
|
|
| BLAKE2b-256 |
fe798c6217c94447cb55fb85a47b9816b5d0a29abcc0b1099cb17ff9cfb2db17
|
File details
Details for the file flake8_enforce_kwargs-0.1.1-py3-none-any.whl.
File metadata
- Download URL: flake8_enforce_kwargs-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfe52484db0f415b38d2386a4ac50a66289523828ba02614ea165200e11a14db
|
|
| MD5 |
efa9c1728c2b7c8c6beb89d022e5f5eb
|
|
| BLAKE2b-256 |
1ab785385660b7e343783e28f758a7d185ed5f24fcdc02a0a39b80ebda29211d
|