flake8 plugin to prevent specific hanging indentations
Project description
flake8-hangover
Flake8 plugin to prevent specific hanging indentations (and more).
Installation
pip install flake8-hangover
Errors
| Code | Description |
|---|---|
| FHG001 | Function argument has hanging indentation |
| FHG002 | Function call positional argument has hanging indentation |
| FHG003 | Function call keyword argument has hanging indentation |
Examples
FHG001 Function argument has hanging indentation
# Hanging indentation on `extra_param`
def _hello_world(param: pd.DataFrame, other_param: sklearn.base.BaseEstimator,
extra_param: Optional[Dict] = None) -> str:
...
# Correct indentation
def _hello_world(param: pd.DataFrame, other_param: sklearn.base.BaseEstimator,
extra_param: Optional[Dict] = None) -> str:
...
# Best practice
def _hello_world(
param: pd.DataFrame,
other_param: sklearn.base.BaseEstimator,
extra_param: Optional[Dict] = None,
) -> str:
...
FHG002 Function call positional argument has hanging indentation
# Hanging indentation on `other_param`
if a != b:
error_message = get_error_message(param,
other_param)
# Correct indentation
if a != b:
error_message = get_error_message(param,
other_param,
)
# Best practice
if a != b:
error_message = get_error_message(
param,
other_param,
)
Not yet implemented cases
Hanging indentation in cases with brackets like this is not yet checked by linter:
# Hanging indentation on `World`
my_string = ('Hello '
'World')
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
flake8-hangover-0.0.1.tar.gz
(4.6 kB
view details)
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-hangover-0.0.1.tar.gz.
File metadata
- Download URL: flake8-hangover-0.0.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dce81f69b969bc3d440bcb25711bf579efee9fa6f10607a54dc9884545aaf0f4
|
|
| MD5 |
0bc29ff81f0f521f020cf50228cda1ad
|
|
| BLAKE2b-256 |
83941e37b99996f1f9f6bb366bd45dac0adbb38df52d0279b3a97ef4cfd77592
|
File details
Details for the file flake8_hangover-0.0.1-py3-none-any.whl.
File metadata
- Download URL: flake8_hangover-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cff3d3465b85f6a00de50ce525609e128f0e740fd28991541e2e4c9073a54bdc
|
|
| MD5 |
ace67ef5e3f37ab320ce097cfd9cf46c
|
|
| BLAKE2b-256 |
a9c2e2a4bb3f797f796c6fd43389cb3edc089a0dce71565a41e7f07a8236bd24
|