Flake8 plugin enforcing kwargs spacing rules
Project description
Flake8 Keyword Arguments with Spaces Plugin
The flake8-kwargs-spaces package is a plugin for Flake8 that enforces consistent spacing around the equals sign (=) in function arguments, in both definitions and calls. By integrating this plugin, developers can ensure uniform code formatting and adherence to style guidelines.
Rules
- Multiline: When a keyword argument or default is on its own line (e.g. one argument under the
defor call), use spaces around=→key = 'val'. Violations are reported as EKS100. - Inline: When the argument is on the same line as the
def/call, or when multiple keyword arguments appear on the same line, use no spaces around=→key='val'. Violations are reported as EKS251.
Anti-pattern
def foo(
key='val'
):
return key
foo(
key='val'
)
Best practice
def foo(
key = 'val'
):
return key
foo(
key = 'val'
)
Still anti-pattern
def foo(key = 'val'):
return key
foo(key = 'val')
Still best practice
def foo(key='val'):
return key
foo(key='val')
Installation
From PyPI (once published):
pip install flake8-kwargs-spaces
From source (development or before first publish):
-
Clone the repository and enter it:
git clone git@github.com:sahargavriely/flake8-kwargs-spaces.git cd flake8-kwargs-spaces
-
Run the installation script, then activate the virtual environment:
./scripts/install.sh source venv/bin/activate
-
(Optional) Run the test suite to verify everything works:
pytest tests/ -
The install script builds a wheel under
wheels/. To use the plugin with Flake8, install that wheel in the environment where you want the plugin enforced:pip install ./wheels/flake8_kwargs_spaces-*.whl
-
To avoid conflicts with Flake8’s built-in E251 rule, add a
setup.cfg(or use your existing one) with:[flake8] ignore = E251
License
MIT. See LICENSE.
Thanks
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_kwargs_spaces-0.1.7.tar.gz.
File metadata
- Download URL: flake8_kwargs_spaces-0.1.7.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
405af6aeea0b1d34ede47ef69a3da05e8a1ce3a2b5be7d4440815a6796eaff3c
|
|
| MD5 |
ac3c11097e32ab555925e3f44ea8a14b
|
|
| BLAKE2b-256 |
ca44b6f295361a00b83e986c67e908831e3d1ff4339c719446496e9be30eb2c0
|
Provenance
The following attestation bundles were made for flake8_kwargs_spaces-0.1.7.tar.gz:
Publisher:
release-on-merge.yml on sahargavriely/flake8-kwargs-spaces
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flake8_kwargs_spaces-0.1.7.tar.gz -
Subject digest:
405af6aeea0b1d34ede47ef69a3da05e8a1ce3a2b5be7d4440815a6796eaff3c - Sigstore transparency entry: 1006342197
- Sigstore integration time:
-
Permalink:
sahargavriely/flake8-kwargs-spaces@1932df64ab1cdf1c82ab837876575c35908e99dd -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sahargavriely
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-on-merge.yml@1932df64ab1cdf1c82ab837876575c35908e99dd -
Trigger Event:
push
-
Statement type:
File details
Details for the file flake8_kwargs_spaces-0.1.7-py3-none-any.whl.
File metadata
- Download URL: flake8_kwargs_spaces-0.1.7-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ab318b769bd062f5c3481a35ed9b3dcebb6dddad566cacfe3e02660c3634e87
|
|
| MD5 |
b05ab54725137c2890ec5f7b6cf25429
|
|
| BLAKE2b-256 |
ab3cb8af327918884fdfb8c9d71034761bdc9d6996920db7edf5e02f6b5371f3
|
Provenance
The following attestation bundles were made for flake8_kwargs_spaces-0.1.7-py3-none-any.whl:
Publisher:
release-on-merge.yml on sahargavriely/flake8-kwargs-spaces
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flake8_kwargs_spaces-0.1.7-py3-none-any.whl -
Subject digest:
0ab318b769bd062f5c3481a35ed9b3dcebb6dddad566cacfe3e02660c3634e87 - Sigstore transparency entry: 1006342201
- Sigstore integration time:
-
Permalink:
sahargavriely/flake8-kwargs-spaces@1932df64ab1cdf1c82ab837876575c35908e99dd -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sahargavriely
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-on-merge.yml@1932df64ab1cdf1c82ab837876575c35908e99dd -
Trigger Event:
push
-
Statement type: