Skip to content

line_max_width

Cap line length in characters (not bytes — code points). Optional tab_width for tab expansion.

OptionTypeRequiredDefaultDescription
max_widthinteger (>= 1)yesMaximum number of Unicode scalar values (chars) allowed per line.

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

A source file with a line past the width limit

Section titled “A source file with a line past the width limit”

The rule fires on this repository:

src/
src/ok.rs
src/wide.rs
src/ok.rs
fn a() {}
fn b() {}
src/wide.rs
fn x() {}
this line is intentionally way too long to be acceptable under the limit
fn y() {}

With this .alint.yml:

version: 1
rules:
- id: narrow
kind: line_max_width
paths: "src/**/*.rs"
max_width: 30
level: warning

alint check reports:

Terminal window
--- src/wide.rs ----------------------------------------------------------------
! warning narrow
2:31 line 2 is 72 chars wide; max is 30
Summary (1 violation):
! 1 warning
0 passing * 1 failing

This repository is compliant:

src/
src/a.rs
src/b.rs
src/a.rs
fn a() {}
fn b() {}
src/b.rs
pub fn c() {}

With this .alint.yml:

version: 1
rules:
- id: narrow
kind: line_max_width
paths: "src/**/*.rs"
max_width: 30
level: warning

alint check reports:

Terminal window
v All 1 rule(s) passed.