Spacing check on if, for, while, switch, try statements and around operators.

Configuration

{
    "type": "Spacing",
    "props": {
        "severity": "INFO",
        "spaceIfCondition": "should",
        "spaceForLoop": "should",
        "spaceWhileLoop": "should",
        "spaceSwitchCase": "should",
        "spaceCatch": "should",
        "spaceAroundBinop": true,
        "noSpaceAroundUnop": true,
        "ignoreRangeOperator": true
    }
}

Valid values for spaceIfCondition, spaceForLoop, spaceWhileLoop, spaceSwitchCase and spaceCatch are:

  • should - space should be there between statement and condition
  • shouldNot - space should not be there between statement and condition
  • any - ignores the space check

Invalid

spaceIfCondition set to should

if(true) {}

noSpaceAroundUnop set to true

var a = a ++;

ignoreRangeOperator set to false

for (i in 0...10) {}