IfStmtsMustUseBraces - lpohl-Reply/pmd-github-action GitHub Wiki

Rule: IfStmtsMustUseBraces

Message

Avoid using if statements without curly braces

Description

Avoid using if statements without using braces to surround the code block. If the code formatting or indentation is lost then it becomes difficult to separate the code being controlled from the rest.

Priority

1 (was 3)

Example

if (foo)    // not recommended
    x++;

if (foo) {  // preferred approach
    x++;
}