You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I observed yesterday that when enabling the multiline-if-else rule and running the formatter, else-if blocks were not converted to multiline.
Expected Behavior
Given this code:
if (foo) doFoo()
elseif (bar) doBar()
the formatter for the multiline-if-else rule should convert it to:
if (foo) {
doFoo()
} elseif (bar) {
doBar()
}
Observed Behavior
This code actually formats to:
if (foo) {
doFoo()
} elseif (bar) doBar()
Steps to Reproduce
We had code with this syntax:
if (foo) return doFoo()
elseif (bar) return doBar()
returnnull
Since it probably should have used a lifted return statement or a when statement (or both), my guess is this unique scenario would not be discovered if some other rules were not also disabled - but not entirely sure.
Your Environment
Ktlint 0.50.0, MacOS
This was executed using ktlint-gradle (via ./gradlew ktlintFormat) 11.6.1 on Gradle 8.5
The text was updated successfully, but these errors were encountered:
I observed yesterday that when enabling the multiline-if-else rule and running the formatter,
else-if
blocks were not converted to multiline.Expected Behavior
Given this code:
the formatter for the
multiline-if-else
rule should convert it to:Observed Behavior
This code actually formats to:
Steps to Reproduce
We had code with this syntax:
Since it probably should have used a lifted return statement or a when statement (or both), my guess is this unique scenario would not be discovered if some other rules were not also disabled - but not entirely sure.
Your Environment
Ktlint 0.50.0, MacOS
This was executed using ktlint-gradle (via
./gradlew ktlintFormat
) 11.6.1 on Gradle 8.5The text was updated successfully, but these errors were encountered: