Rule S121 requires the body of control structures to be surrounded by curly braces. This is generally considered best practice with one exception:
Early return statements are often written as a single line with no braces: if (condition) return false;. This style is so common that code that's auto-generated by IntelliJ for equals (and possibly other methods) uses this style as well.
To not report issues on what's commonly considered idiomatic code, we should not raise an issue when the following conditions are met:
- The control structure in question is an if statement
- The body is on the same line as the if keyword and no further statements appear on that same line.
- The body is a return, break or continue statement.
The description of the rule should be updated (for Java) to document this exception.