Flake8 plugin to enforce a maximum number of lines per file
Project description
flake8-file-length (FLN)
A Flake8 plugin that enforces a maximum number of lines per file.
- Plugin name: flake8-file-length
- Version: 0.1.0
- Error code prefix: FLN
- Primary rule:
FLN001 file too long: {count} lines (limit {limit}){suffix}- When any ignore option is active, the message includes a suffix with total and effective counts:
— total=…, effective=….
- When any ignore option is active, the message includes a suffix with total and effective counts:
Installation
pip install flake8-file-length
Check flake8 version to ensure the plugin is registered:
flake8 --version
7.3.0 (flake8-file-length: 0.1.0, mccabe: 0.7.0, pycodestyle: 2.14.0, pyflakes: 3.4.0) CPython 3.13.7 on Linux
Quick start
Run Flake8 selecting only this plugin on your source tree:
flake8 --select FLN path/to/code
By default, files longer than 400 lines will trigger FLN001.
Configuration
You can configure the plugin via any Flake8-supported config file (.flake8, setup.cfg, tox.ini, or pyproject.toml under the [tool.flake8] table). Options:
--max-file-length INT(default 400)--file-length-ignore-blank(bool; default false)--file-length-ignore-comments(bool; default false)--file-length-ignore-shebang(bool; default true)
Example .flake8:
[flake8]
select = FLN
max-file-length = 120
file-length-ignore-blank = true
file-length-ignore-comments = true
file-length-ignore-shebang = true
Precommit hook example
To use with pre-commit, add to your .pre-commit-config.yaml:
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
additional_dependencies:
- flake8-file-length==0.1.0
args:
- --select=FLN
- --max-file-length=300
- --file-length-ignore-blank
- --file-length-ignore-comments
- --file-length-ignore-shebang
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flake8_file_length-0.1.0.tar.gz.
File metadata
- Download URL: flake8_file_length-0.1.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fb3396d70c23151588191e928f4e1ef36bf4f99899b9521155b1fe36ab52c97
|
|
| MD5 |
5f7cc954e16edb20198381a37cff9009
|
|
| BLAKE2b-256 |
8659ec3bdad8161dda068bc7fba82d58d1056321ddb1c0beb135f712b532d4fc
|
Provenance
The following attestation bundles were made for flake8_file_length-0.1.0.tar.gz:
Publisher:
release.yaml on elterrien/flake8-file-length
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flake8_file_length-0.1.0.tar.gz -
Subject digest:
1fb3396d70c23151588191e928f4e1ef36bf4f99899b9521155b1fe36ab52c97 - Sigstore transparency entry: 515663329
- Sigstore integration time:
-
Permalink:
elterrien/flake8-file-length@ff2d574c61c158a992974350fe776aa93793b1a9 -
Branch / Tag:
refs/heads/github-pypi-workflow - Owner: https://github.com/elterrien
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@ff2d574c61c158a992974350fe776aa93793b1a9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file flake8_file_length-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flake8_file_length-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17b0b88f5fe432238ec8a30fb73118c2d774840a681ee9114f7bf1fd3df6f700
|
|
| MD5 |
1e95b371cd74fe24b94baec9ae7ec507
|
|
| BLAKE2b-256 |
8b381f6f094052698ab03118772f785f61037a58fbfc10740ab5e97dd460c532
|
Provenance
The following attestation bundles were made for flake8_file_length-0.1.0-py3-none-any.whl:
Publisher:
release.yaml on elterrien/flake8-file-length
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flake8_file_length-0.1.0-py3-none-any.whl -
Subject digest:
17b0b88f5fe432238ec8a30fb73118c2d774840a681ee9114f7bf1fd3df6f700 - Sigstore transparency entry: 515663343
- Sigstore integration time:
-
Permalink:
elterrien/flake8-file-length@ff2d574c61c158a992974350fe776aa93793b1a9 -
Branch / Tag:
refs/heads/github-pypi-workflow - Owner: https://github.com/elterrien
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@ff2d574c61c158a992974350fe776aa93793b1a9 -
Trigger Event:
push
-
Statement type: