erlfmt enforces a maximum line length by parsing and re-printing code. If a line exceeds the limit, the formatter automatically converts it to a vertical style.
Example of automatic vertical formatting:
Input:
scenario(dial_phone_number(), ring(), hello(mike),hello(joe), hello(robert), system_working(), seems_to_be())
Output:
scenario(
dial_phone_number(),
ring(),
hello(mike),
hello(joe),
hello(robert),
system_working(),
seems_to_be()
)
Note: Line-length enforcement is a best-effort greedy algorithm and may occasionally overrun the selected limit.
Manual Intervention: Because erlfmt is not allowed to change the AST (Abstract Syntax Tree), it cannot perform semantic refactors like extracting variables to shorten lines. If the automatic vertical layout is undesirable, you must manually refactor the code (e.g., extracting a long expression into a variable) to allow it to fit on a single line.