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
Braces are otherwise required for any if, for, when branch, do, and while statements and expressions, even when the body is empty or contains only a single statement.
I do think this behavior fits well for ktlint_official code style, and for android_studio code style because it is mentioned explicitly.
This behavior is to be added to new experimental rule control-flow-braces. Also note that the block of a multiline if-statement without else should be wrapped between braces.
Forcing braces in multiline if-else improves readability, so why not extend it to all control flow statements:
for
,while
, andif
?Expected Behavior
Violations:
for (character in string)
if (character.isDigit())
Current Behavior
Violations:
if (character.isDigit())
Additional information
The text was updated successfully, but these errors were encountered: