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
The DOT QUALIFIED EXPRESSION prevents the braces from being added. It works for:
fun foo() {
if (offset.value == 0) headerBackgroundColor()
else headerBackgroundColor()
}
paul-dingemans
changed the title
ktlint -F multiline-if-else rule only adds braces for if statement and not else
No braces added in multiline-if-else with dot qualified expression in else branche
May 25, 2023
Expected Behavior
ktlint -F multiline-if-else rule should add Braces for both
if
andelse
.Observed Behavior
Braces added only for
![image](https://private-user-images.githubusercontent.com/4817549/240907135-e8cc6fcb-43c9-40a8-b502-7365417f3f17.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0MDg4ODgsIm5iZiI6MTcyNDQwODU4OCwicGF0aCI6Ii80ODE3NTQ5LzI0MDkwNzEzNS1lOGNjNmZjYi00M2M5LTQwYTgtYjUwMi03MzY1NDE3ZjNmMTcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjNUMTAyMzA4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Mzc2NTQ4ODQ3Nzc2ODQ2MTZmYmZkN2E1OGQzY2RhYjZkNGE1NTJhZWVkNWFhNDVmZDkyMzgwM2FkODZmY2EwNSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.yKwkK37-ZpoZAlY0fAZmuO-GVK4EXZg_uh8D7DzmgDQ)
if
Steps to Reproduce
Write a multiline if/else statement without braces.
Run ktlint -F
Your Environment
.editorconfig
settingsThe text was updated successfully, but these errors were encountered: