Skip to content

Layout Rules ​

The layout rules rewrite a bracketed construct that has outgrown one line, a call to one argument per line, expanding a signature to one parameter per line and a collection across rows, and splitting a from … import … into a of statements. Each rule fires on a width such as code-line-length, a count cap such as max-args, or both, so the inline form gives way to the stacked one at the point it stops being legible. No layout rule breaks a line inside an or t-string replacement field, so an over-wide interpolation is left for line-overflow to report.

Rules

Layout

reflow-calls

Explodes a call to one argument per line once its argument count passes max-args, its width passes code-line-length, or an argument spans rows, and rejoins a list broken anywhere else onto one row.

Layout

reflow-collections

Expands a list, tuple, dict, or set literal across lines once it overflows code-line-length or a dict passes max-dict-entries, and rejoins a construct broken anywhere but an entry boundary.

Layout

reflow-imports

Splits a from … import … that overflows import-line-length into repeated-prefix statements, breaks a comma-joined import a, b into one statement per module, and merges repeated from statements of one module into one line.

Layout

reflow-parentheses

Removes a grouping parenthesis pair that changes nothing, and breaks one whose joined form overflows code-line-length into a row per operand, adding the pair around an over-budget test, returned value, or assigned value.

Layout

reflow-signatures

Writes a function signature either on one line or one parameter per line, expanding it once it overflows code-line-length, passes max-params, or carries a parameter spanning rows.

Layout

stack-adjacent-strings

Breaks a run of implicitly concatenated string literals to one literal per line once the joined line overflows code-line-length.

Layout

stack-method-chains

Breaks a method chain to one link per line once it overflows code-line-length or carries more links than max-links, hanging each link beneath the head's dot.

0.11.0Versione83e7e6Commit43Rules1830Fixtures2026-11-19Updated