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
In our company we are enforcing to remove curly braces whenever possible for example in if that have a single statement, this lead us to find a situation that was not expected with keyword-spacing rule.
Expected Behavior
Do not require else to be in the same line of a right brace if the right brace is not part of the if statement.
Observed Behavior
[keyword-spacing] Unexpected newline before "else"
Steps to Reproduce
Redacted code based on real code, that should triggers the error.
if (foo !=false)
when (bar) {
A-> {
foo2.bar(1)
}
B-> foo2.bar(2)
C, D-> {
foo2.bar(3)
}
}
else log.info("foo")
Your Environment
Version of ktlint used: 0.36
Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): org.jmailen.gradle:kotlinter-gradle:2.2.0
Version of Gradle used (if applicable): 6.2.2
Operating System and version: MacOs Catalina 10.15.4
The text was updated successfully, but these errors were encountered:
In our company we are enforcing to remove curly braces whenever possible for example in if that have a single statement, this lead us to find a situation that was not expected with
keyword-spacing
rule.Expected Behavior
Do not require
else
to be in the same line of aright brace
if theright brace
is not part of theif
statement.Observed Behavior
[keyword-spacing] Unexpected newline before "else"
Steps to Reproduce
Redacted code based on real code, that should triggers the error.
Your Environment
The text was updated successfully, but these errors were encountered: