flake8-clean-block
This is a flake8 plugin that enforces a blank line after if/for/while/with/try blocks in Python code.
Installation
pip install flake8-clean-block
Violation codes
There is one violation code that this plugin reports:
| Code | Description |
|---|---|
| CLB100 | no blank line after the end of an indented block |
Style examples
Wrong
This plugin considers the following styles wrong:
for i in range(5):
print(i)
some_var = 2
for i in range(5):
print(i)
if k == 2:
print(k)
else:
print("k")
for j in range(5):
print(j)
for i in range(5): a += i
print(a)
with open('filename.txt', 'r') as fp:
content = fp.readlines()
print(content)
Correct
Correspondingly, here are the correct styles, because they are easier to read and less error-prone:
for i in range(5):
print(i)
some_var = 2
for i in range(5):
print(i)
if k == 2:
print(k)
else:
print("k")
for j in range(5):
print(j)
for i in range(5): a += i
print(a)
with open('filename.txt', 'r') as fp:
content = fp.readlines()
print(content)
Rationale
When two lines belonging to different indentation level are right next to each other, it's difficult to read. Additionally, accidentally hitting the "tab" key on the outer line leads to subtle and hard-to-find bugs (and vice versa).
Therefore, it's better that we add at least one blank line between lines of different indentation levels.
Metadata
Release files for flake8-clean-block 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flake8_clean_block-0.1.2.tar.gz | 3.7 kB | Without provenance | Details for flake8_clean_block-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flake8_clean_block-0.1.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for flake8_clean_block-0.1.2-py2.py3-none-any.whl |
Total release size: 7.9 kB
Release files / flake8_clean_block-0.1.2.tar.gz
| Download URL | flake8_clean_block-0.1.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a1f8a58be210a013715810a78dda029a65660373f585b7e14e36c3b85c7791d
|
|
BLAKE2b-256 checksum How to use checksums |
31985a64a773cff79046fdad28eb25de18322d7d2e26e3895cd7c1abed8134fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Release files / flake8_clean_block-0.1.2-py2.py3-none-any.whl
| Download URL | flake8_clean_block-0.1.2-py2.py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9684c26a6b087e25f73966fe8f4a38f6abb3e9737a9f781140115e0e2c14a93c
|
|
BLAKE2b-256 checksum How to use checksums |
0bd3cc0037b86f87c1ec28fa970d7325e1b6b6ba54c26f853501d0c5e5d764df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Security for flake8-clean-block 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.