Inspectopedia
 
2024.3

Simplifiable statement

Warning
New
Last modified: 03 December 2024

Reports the statements that can be simplified, such as constant conditions, identical if branches, redundant boolean expressions, and others. Use the checkboxes below to control the analysis options:

  • Simplify "if (true)", "while(false)": suggest replacing the if/while statement with a boolean literal.

  • Simplify "condition == true": suggest replacing equality statements with boolean literals.

  • Simplify "condition1 ? true : condition2;": suggest simplifying ternary operators where one of the expressions is a boolean literal.

  • Simplify "if (condition1) return true; return condition2;": suggest simplifying if where a boolean literal is returned if the condition is true and another condition is returned otherwise.