Skip to main content

FLAKE8-LINELEAK

Introduction

If your script has more than a set number of lines, your code lines are leaking :) …And if your code lines are leaking, it’s difficult to navigate and understand :).

Lineleak is a flake8 plugin that counts the lines containing live code in a script, and ‘yells’ if a set limit is exceeded. It is meant to help enforce short scripts and modular python programming.

For usefulness, lineleak only counts lines which contains live code. Thus the following lines are excluded from a count:

  • Blank lines

  • Comment lines

  • Lines of a docstring

Usage

To benefit from lineleak, Use flake8 the usual way with plugins:

$ flake8 [options] file ...

The default line count limit is set at 100, and imposed on physical lines. These defaults, however, can be overridden with optional arguments as shown below and illustrated in the illustration section:

  optional arguments:

--lineleak-logical
           Applies line count limit to logical lines.

--max-line-count=MAX_LINE_COUNT
       Changes the maximum limit for live code line count.

--live-code-count
           Displays the number of physical and logical lines containing live code.

--lineleak-ignore
           Specifies a comma separated list of paths of files which leakline must ignore.

Codes

  • LLW404 Reports that logical line count has exceeded limit

  • LLW405 Reports that physical line count has exceeded specified limit

  • LLI200 Informs about the number of logical and physical lines containing live code.

Illustration

  1. Overriding default line count limit (limit -> 100):

    $ flake8 --max-line-count=50 testfile.py
    testfile.py:82:1: LLW405 Maximum number of physical live code lines (50) exceeded.
  2. Imposing limit on logical, instead of physical, lines:

    $ flake8 --max-line-count=50 --lineleak-logical testfile.py
    testfile.py:103:1: LLW404 Maximum number of logical live code lines (50) exceeded.
  3. Display just the number of lines containing live code:

    $ flake8 --live-code-count testfile.py
    testfile.py:118:1: LLI200 [INFO] Live code count: 56 logical and 79 physical lines
  4. Ignore file(s) by specifying a comma separated list of their file paths.

    Results using lineleak-ignore:

    $ flake8 --max-line-count=5 --filename=*.py --lineleak-ignore=.\lineleak.py,.\subber.py
    .\lineleak0.9.9.py:19:1: LLW405 Maximum number of physical live code lines (5) exceeded.
    .\setup.py:10:1: LLW405 Maximum number of physical live code lines (5) exceeded.

    Results without lineleak-ignore:

    $ flake8 --max-line-count=5 --filename=*.py
    .\lineleak.py:19:1: LLW405 Maximum number of physical live code lines (5) exceeded.
    .\lineleak0.9.9.py:19:1: LLW405 Maximum number of physical live code lines (5) exceeded.
    .\setup.py:10:1: LLW405 Maximum number of physical live code lines (5) exceeded.
    .\subber.py:10:1: LLW405 Maximum number of physical live code lines (5) exceeded.
  5. Ignore limit enforcement.

    In adherence with flake8 design principles, lineleak can be silenced by adding the appropriate error codes of lineleak to the ignore list:

    $ flake8 --ignore=LL testfile.py
    $

Installation

Install using pip:

pip install flake8-leakline

Dependencies & Compatibility

  • Requires flake8 >= 3.3

  • Requires python >= 3.4

Environment

  • Shell

Software Cycle Stage

  • Development - Alpha

Metadata

Release files for flake8-lineleak 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-lineleak 1.0.2
File Size Uploaded Provenance Actions
flake8-lineleak-1.0.2.tar.gz 4.7 kB Without provenance Details for flake8-lineleak-1.0.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for flake8-lineleak 1.0.2
File Interpreter ABI Platform Actions
flake8_lineleak-1.0.2-py3.7.egg Legacy Egg format - - Details for flake8_lineleak-1.0.2-py3.7.egg
flake8_lineleak-1.0.2-py3-none-any.whl Python 3 none any Details for flake8_lineleak-1.0.2-py3-none-any.whl

Total release size: 17.1 kB

Release files / flake8-lineleak-1.0.2.tar.gz

Download URL flake8-lineleak-1.0.2.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c965ce4682f1acb58e9cfb1925bb015eb5371dcb757c2adbd81036c936c1f2e2
BLAKE2b-256 checksum
How to use checksums
84c351b4e2b777fe700074f2b091dcac82275fdc394630b0933c4fd9d36851ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1

Release files / flake8_lineleak-1.0.2-py3.7.egg

Download URL flake8_lineleak-1.0.2-py3.7.egg
Size 6.8 kB
Tags Egg
SHA-256 checksum
How to use checksums
5bd89769939e97e932d4dd1b83fd1eecece6ceaf1db6ab4fb2c509802c86384b
BLAKE2b-256 checksum
How to use checksums
9f2b35710c7fd9aee9f36e4dad078bd08830cbf02fa530ccca765faa0fa006b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1

Release files / flake8_lineleak-1.0.2-py3-none-any.whl

Download URL flake8_lineleak-1.0.2-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
049697250e6819bec0165c20402f32da1ca09d3233763fd467b1e5fd11fcf57c
BLAKE2b-256 checksum
How to use checksums
199ba72b7110ee5a03a15800a0a9f005e9f1ce73f4ef881a0e3805734b3453b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1

Security for flake8-lineleak 1.0.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page