Pattern: if
without braces
Issue: -
Some people find if clauses with braces easier to read. The singleLineAllowed
property allows if constructions of the type:
if (bool_expression) expression1 else expression2
The doubleLineAllowed
property allows if constructions of the type:
if (bool_expression) expression1
else expression2
Note: If you intend to enable only if expressions in the format below, disable the IfBraceChecker
altogether.
if (bool_expression)
expression1
else
expression2
Name | Description | Type | Default Value |
---|---|---|---|
singleLineAllowed | Single Line Allowed | boolean | true |
doubleLineAllowed | Double Line Allowed | boolean | false |
<check enabled="true" class="org.scalastyle.scalariform.IfBraceChecker" level="warning">
<parameters>
<parameter name="singleLineAllowed">true</parameter>
<parameter name="doubleLineAllowed">false</parameter>
</parameters>
</check>