Metadata-Version: 2.4
Name: flake8-file-length
Version: 0.1.0
Summary: Flake8 plugin to enforce a maximum number of lines per file
Author-email: Elie Terrien <contact@elie-terrien.fr>
License-Expression: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: flake8>=7.1.1

# 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=…`.

## Installation

```bash
pip install flake8-file-length
```

**Check flake8 version to ensure the plugin is registered:**

```bash
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:

```bash
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`:

```ini
[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`:

```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
```
