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 hashes)
Built Distribution
Close
Hashes for flake8_hangover-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cff3d3465b85f6a00de50ce525609e128f0e740fd28991541e2e4c9073a54bdc |
|
MD5 | ace67ef5e3f37ab320ce097cfd9cf46c |
|
BLAKE2b-256 | a9c2e2a4bb3f797f796c6fd43389cb3edc089a0dce71565a41e7f07a8236bd24 |