Skip to content

Alignment Rules

The alignment rules align a shared token across consecutive rows so columns of assignments, annotations, and patterns read as vertical groups. The shared math lives in the Aligner primitive, and each rule supplies the walker that decides what counts as a group. The per-rule max-shift facet bounds how far rows shift to align, wherein each rule walks a run in source order and breaks a fresh group at the first row whose width spread would exceed the cap. false lifts the cap so a contiguous run folds into one column, and 0 forbids any shift. A # prose: skip on one row holds it out of its group while the rest align around it.

align-colons

Alignment

Aligns the : separator across dict literals, annotated assignments, function-signature annotations, and Google-style docstring sections.

align-comparisons

Alignment

Aligns comparison operators vertically across the operands of a multi-line and-chain or or-chain.

align-equals

Alignment

Aligns the = separator across consecutive single-target assignments, annotated function-parameter defaults, and an exploded call's keyword arguments.

align-imports

Alignment

Aligns the import and as keywords across consecutive import statements.

align-match-case

Alignment

Aligns the post-pattern : across single-expression case bodies inside a match statement.

strip-align-padding

Alignment

Strips padding that lines up with nothing and settles the gap after a colon, in one-member alignment groups and just inside bracket delimiters.

For the per-rule facets, see the Configuration reference. For the math the rules share, see the Aligner primitive. The ColonTargets walker drives the five : contexts the alignment rules read against.