Registry / testing / flake8-broken-line

flake8-broken-line

JSON →
library1.0.0pypypi✓ verified 23d ago

flake8-broken-line is a Flake8 plugin that enforces a coding style prohibiting the use of backslashes for line breaks in Python code. It helps maintain code readability and consistency by encouraging alternative line-breaking conventions, such as using parentheses for implicit line joining. The current version is 1.0.0, and it maintains a moderate release cadence, with updates typically focusing on Python and Flake8 compatibility.

pip install flake8-broken-line
INSTALL
IMPORT
SIG · FLAKE8-BROKEN-LINE
F
flake8-broken-line
testingpythonv1.0.0
Install
2.0s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.0s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

N/A (auto-discovered plugin)
No direct import statement is needed. The plugin is automatically loaded by Flake8 upon installation.
flake8-broken-line integrates directly into the flake8 CLI. Its checks (e.g., N400) are enabled implicitly after installation.

Install the plugin, create a Python file containing a backslash for line continuation, and then run `flake8` against the file to observe the `N400` error reported by the plugin.

# test_broken_line.py message = 'This is a long string that \ uses a backslash for line continuation.' def my_function(arg1, \ arg2): # This backslash is a violation pass # To run this example, save the code as 'test_broken_line.py' # and execute 'flake8 test_broken_line.py' in your terminal. # You should see an N400 error reported.
Debug
Known issues
breakingOlder versions of `flake8-broken-line` may not be compatible with newer major versions of `flake8`. For example, versions prior to 0.4.0 might not support `flake8` 4.x, and versions prior to 0.5.0 might not support `flake8` 5.x.
fix
Always upgrade `flake8-broken-line` to its latest version (1.0.0 or newer) to ensure compatibility with recent `flake8` installations (typically `flake8 >= 5.0`). Check the project's release notes for specific compatibility matrix if issues arise.
affects: <1.0.0
gotchaVersions of `flake8-broken-line` prior to 0.2.1 contained a bug that caused incorrect flagging of backslashes used within triple-quoted strings (e.g., `"""docstring\ncontinuation"""`), leading to false positives.
fix
Upgrade to `flake8-broken-line` version 0.2.1 or newer to resolve the issue of false positives when detecting backslashes within triple-quoted string literals.
affects: <0.2.1
gotchaThere are known limitations where the plugin might not correctly handle backslashes in specific contexts, such as raw f-strings (e.g., `rf"...\n..."`) or where PEP 8 historically allowed backslashes for `with` statements. This can result in unexpected `N400` errors or missed violations.
fix
If encountering unexpected `N400` errors or missed violations in specific scenarios (like `rf` strings), refer to the official GitHub issues page to check for known limitations or potential workarounds. You may need to use `# noqa: N400` as a temporary measure.
affects: All versions up to 1.0.0
Upgrade
Version history
1.0.0latest on PyPI · released May 31, 2023
Audit
Dependencies
flake8requiredThis is a plugin for Flake8 and requires Flake8 to be installed to function correctly.
Agent activity
11 hits · last 30 days
node
10
Resources
flake8-broken-line — pip install flake8-broken-line · libregistry