Skip to main content

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.

Release files for flake8-enforce-kwargs 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-enforce-kwargs 0.1.1
File Size Uploaded
flake8-enforce-kwargs-0.1.1.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flake8-enforce-kwargs 0.1.1
File Interpreter ABI Platform
flake8_enforce_kwargs-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size:9.2 kB

Release files / flake8-enforce-kwargs-0.1.1.tar.gz

Download URL flake8-enforce-kwargs-0.1.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
86da0506458dab98575e85531fa5cc16b54e87e9cb5c4b83783264bf74c1b71e
BLAKE2b-256 checksum
How to use checksums
fe798c6217c94447cb55fb85a47b9816b5d0a29abcc0b1099cb17ff9cfb2db17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / flake8_enforce_kwargs-0.1.1-py3-none-any.whl

Download URL flake8_enforce_kwargs-0.1.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfe52484db0f415b38d2386a4ac50a66289523828ba02614ea165200e11a14db
BLAKE2b-256 checksum
How to use checksums
1ab785385660b7e343783e28f758a7d185ed5f24fcdc02a0a39b80ebda29211d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page