Skip to content

Provide an automatic fix for NeedBraces #17

Description

@EliteMasterEric

Config example:

{
    "type": "NeedBraces",
    "props": {
        "allowSingleLineStatement": true,
        "tokens": [
            "FOR",
            "IF",
            "ELSE_IF",
            "WHILE",
            "DO_WHILE"
        ],
        "severity": "INFO"
    }
}

Code example:

  function testFunction(input:String):Int {
    // valid, one line.
    if (input == "one") return 1;
    // valid, uses braces.
    if (input == "seven") {
        return 7;
    }
    // Invalid, triggers check style NeedsBraces.
    /*
    if (input == "nine") 
        return 9;
    */
    // Automatic fix applied.
    if (input == "nine") {
        return 9;
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions