Skip to content

Layout Rules

The layout rules rewrite a bracketed construct that has outgrown one line, exploding a call, a signature, a collection, or a from … import … to one entry per line so each entry reads on its own and a later edit touches a single row. Each rule fires on a width budget 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.

reflow-calls

Layout

Explodes a call to one keyword 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.

reflow-collections

Layout

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.

reflow-imports

Layout

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.

reflow-parentheses

Layout

Removes a grouping parenthesis pair that changes nothing, and breaks one whose joined form overflows code-line-length into a row per operand.

reflow-signatures

Layout

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.

stack-adjacent-strings

Layout

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

stack-method-chains

Layout

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.

The Configuration reference lists the per-rule facets, and the Pipeline Order reference lists where these rules run (layout settles the bracketed form early, so the alignment rules measure their columns against the layout it writes).