Z024: Line exceeds maximum length
Detects lines that exceed the configured maximum length in source bytes (default: 120). CRLF terminators are not included in the count.
Examples
Bad
// expect: Z024
const very_long_variable_name_that_exceeds_the_limit = some_function_with_a_long_name(parameter_one, parameter_two, parameter_three);Good
Break long lines:
const result = some_function_with_a_long_name(
parameter_one,
parameter_two,
parameter_three,
);
Or use intermediate variables:
const params = .{ parameter_one, parameter_two, parameter_three };
const result = some_function_with_a_long_name(params);Configuration
| Option | Type | Default | Description |
|---|---|---|---|
max_length | u32 | 120 | Maximum allowed source bytes per line |
Example .ziglint.zon:
.{
.rules = .{
.Z024 = .{ .max_length = 100 },
},
}Rationale
Long lines are hard to read, especially in side-by-side diffs or on smaller screens. A consistent line length limit encourages breaking up complex expressions and improves readability.