Back to directory
wemake-services avatar
wemake-services / flake8-broken-line

flake8-broken-line

🚨 Flake8 plugin to forbid backslashes (\) for line breaks

111

Stars

74

Forks

1

Watchers

MIT

License

flake8-broken-line

wemake.services Build Status codecov Python Version PyPI version wemake-python-styleguide

Do not break the line! 🚨

Installation

pip install flake8-broken-line

It is also a valuable part of wemake-python-styleguide.

Code example

Things we check with this plugin:

# String line breaks, use `()` or `"""` instead:

some_string = 'first line\
second line'

# Use a single line, `()`, or new variables instead:

if 1 == 1 and \
    2 == 2:
    print('Do not do that!')

# Do not use for method chaining:
some_object \
  .call_method(param1, param2) \
  .call_other(keyword=value) \
  .finalize()

# Instead use:
some_objects.call_method(
    param1, param2,
).call_other(
    keyword=value
).finalize()

Error codes

Error code Description
N400 Found backslash that is used for line breaking

License

MIT.

Releases

Oct 29, 2020

Version 0.3.0

Download .zip

Features

python3.9 support

Misc

Moves to Github Actions Poetry version update

Jul 8, 2020

Version 0.2.1

Download .zip

Bugfixes

Fixes incorrect \ detection inside the """

Mar 13, 2020

Version 0.2.0

Download .zip

Features

Adds python3.8 support

Bugfixes

Fixes a bunch of false positives