alphabetize
OrderingProse alphabetizes import siblings, dict-key blocks, and
A call carrying enough arguments to read as a wall of positionals folds better one argument per line, where the eye reads each binding on its own and a later edit touches a single line.
takes a call whose argument count exceedsmax-inline-args and breaks it so each argument lands on its own line in keyword form, leaving shorter calls inline.The pass fires only on a call every argument of which is keyword-expressible. A positional argument resolves to its parameter name through the call site's in-module binding, so the exploded form reads name=value whatever order the source passed it. A positional-only prefix, a * or ** unpacking, and a positional call whose callee does not resolve to a module function each leave the call inline, because the rule cannot name those arguments. The expanded form lays each argument one indent step past the call, the closing ) dropping to the call's own indent, and a nested eligible call in an argument value explodes in the same pass.
The rule reshapes layout and nothing more. Argument order stays with , which runs ahead of it, so disabling alphabetization leaves the exploded arguments in source order. The = spacing stays with , and whether the last argument carries a trailing comma stays with , which the explode carries through untouched.
| Key | Type | Default | Meaning |
|---|---|---|---|
enabled | bool | true | Toggle the rule on or off |
max-inline-args | positive int | false | 3 | Cap on the argument count an inline call can carry. A call exceeding the cap explodes, so the default 3 explodes a call of four or more arguments. Setting false disables the count trigger and leaves every call inline |
A four-argument call to an in-module function explodes to one keyword argument per line, each positional argument named from the resolved signature and the closing ) dropping to the call's own indent.
def connect(host, port, timeout, user):
return (host, port, timeout, user)
session = connect(
host=h,
port=p,
timeout=t,
user=u
)
An eligible call passed as an argument value explodes alongside its enclosing call, the recursion resolving both levels before the rule returns so the layout is stable in one pass.
An all-keyword method call explodes the same as a free function, the attribute callee carrying its arguments without any signature resolution.
A four-argument all-keyword call explodes regardless of where its callee is defined, because every argument already names its parameter and needs no signature resolution.
A three-argument call sits at the default max-inline-args cap and reads fine on one line, so the rule leaves it untouched.
Prose alphabetizes import siblings, dict-key blocks, and
Prose splits list, tuple, dict, and set literals into one-entry-per-line layout once they overflow their width, or a dict crosses an entry-count cap.
Prose normalizes function signatures to one line or one parameter per line, gated by line length and inline-parameter count.
Prose removes trailing commas from inside single-line collections.