chain-method-continuation
What it does
Section titled “What it does”Reports a call chain (a.b().c(), with ?. too) whose line breaks differ from what the formatter writes.
Why it matters
Section titled “Why it matters”A chain that is broken in some places and not in others hides which calls belong together, and a later edit adds or moves breaks. One layout for all chains makes each step visible and keeps the diff small.
To fix, run the formatter.
Example
Section titled “Example”... } foo(); bar() val c = someVeryLongReceiverName.firstFunctionCall(argumentNumberOne).secondFunctionCall(argumentNumberTwo).thirdFunctionCall(argumentNumberThree)...}Configuration
Section titled “Configuration”kotlin: lint: rules: chain-method-continuation: warn # off (default), warn, errorEnabled by the presets: kotlin/ktlint.
Suppress one line with sudsy-disable-next-line chain-method-continuation in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ktlint | chain-method-continuation |
full |