align-colons
AlignmentProse aligns the : separator across dict literals, Args: blocks.
A run of consecutive bindings sits at the same indentation, the eye walks down the page, and every = sign lands at a different column. The reader stops at each line to find where the assignment splits.
The rule walks consecutive single-target assignments at the same indentation level, picking up type annotations when present and treating augmented assignments (+=, |=) and walrus operators (:=) as non-members. The same alignment also runs across consecutive annotated function-parameter default values, so a signature with several param: type = default entries aligns its = column the same way a stretch of module-level bindings does. A blank line, a comment line, or a non-assignment statement resets the group, leaving each contiguous run aligned in isolation. Once an alignment group lands,
| Key | Type | Default | Meaning |
|---|---|---|---|
enabled | bool | true | Toggle the rule on or off |
max-shift | positive int | 8 | Ceiling on per-line padding |
max-shift-policy | "split" | "drop" | "split" | How to handle a max-shift. See the per-rule knobs for the full semantics |
max-shift caps the per-line padding the alignment can introduce. When a group's widest member would force more padding than the cap allows, max-shift-policy decides the fallback shape, which defaults to "split". The per-rule knobs reference covers the "drop" policy.
Three consecutive = sign. The eye drops down the column of equals signs and reads the right-hand sides as a parallel list.
x = 1
foo = 2
bar_baz = 3
An outlier target partitions the split policy. The width bands seed from the widest member down, so the outlier sits alone collapsed to one space while every other member shares the dominant = column.
An augmented assignment like beta += 2 aligns its = on the shared column, so the + sits one column before the equals shared by the neighboring plain
A = column rather than aligning across the gap.
A comment line between two runs splits them into independent groups, mirroring the = column.
Annotated parameter defaults align across a multi-line signature. The = column sits one space past the widest =.
An annotated assignment carrying an initializer like beta: int = 2 joins the run, its effective left-hand width extending through the = lands on the shared column with the plain
A run whose = already share a column is
A chained assignment like a = b = 1 carries two = tokens, so the rule skips it rather than guess which one to align, while the surrounding single-target
A parameter whose
Prose aligns the : separator across dict literals, Args: blocks.
Prose aligns the import and as keywords across consecutive import statements.
Prose aligns the post-pattern : across single-expression case bodies inside a match statement.
Prose strips padding from