Skip to content

file_max_lines

File must have at most max_lines lines, using the same accounting as file_min_lines. Catches the everything-module anti-pattern — a lib.rs / index.ts / helpers.py that grew unbounded.

OptionTypeRequiredDefaultDescription
max_linesinteger (>= 0)yesMaximum allowed line count.

Plus the common paths, level, id, and when fields. This table is generated from the JSON Schema; option types and defaults are authoritative.

The rule fires on this repository:

src/
src/bloated.rs
src/tiny.rs
src/bloated.rs
fn a() {}
fn b() {}
fn c() {}
fn d() {}
fn e() {}
fn f() {}
fn g() {}
src/tiny.rs
fn a() {}

With this .alint.yml:

version: 1
rules:
- id: cap-source-file
kind: file_max_lines
paths: "src/**/*.rs"
max_lines: 5
level: warning

alint check reports:

Terminal window
--- src/bloated.rs -------------------------------------------------------------
! warning cap-source-file
file has 7 line(s); at most 5 allowed
Summary (1 violation):
! 1 warning
0 passing * 1 failing

This repository is compliant:

src/
src/medium.rs
src/tiny.rs
src/medium.rs
fn a() {}
fn b() {}
fn c() {}
fn d() {}
fn e() {}
src/tiny.rs
fn a() {}

With this .alint.yml:

version: 1
rules:
- id: cap-source-file
kind: file_max_lines
paths: "src/**/*.rs"
max_lines: 5
level: warning

alint check reports:

Terminal window
v All 1 rule(s) passed.