line_max_width
Cap line length in characters (not bytes — code points). Optional tab_width for tab expansion.
Options
Section titled “Options”| Option | Type | Required | Default | Description |
|---|---|---|---|---|
max_width | integer (>= 1) | yes | Maximum 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.
Example
Section titled “Example”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.rssrc/wide.rsfn a() {}fn b() {}fn x() {}this line is intentionally way too long to be acceptable under the limitfn y() {}With this .alint.yml:
version: 1rules: - id: narrow kind: line_max_width paths: "src/**/*.rs" max_width: 30 level: warningalint check reports:
--- src/wide.rs ---------------------------------------------------------------- ! warning narrow 2:31 line 2 is 72 chars wide; max is 30
Summary (1 violation): ! 1 warning 0 passing * 1 failingEvery line stays within the width limit
Section titled “Every line stays within the width limit”This repository is compliant:
src/src/a.rssrc/b.rsfn a() {}fn b() {}pub fn c() {}With this .alint.yml:
version: 1rules: - id: narrow kind: line_max_width paths: "src/**/*.rs" max_width: 30 level: warningalint check reports:
v All 1 rule(s) passed.