Inspectopedia Help

Control flow issues

'break' statement  

Reports break statements outside of switch statements.

'continue' statement  

Reports continue statements.

'return' statement can be implicit  

Reports return statements at the end of closures which can be made implicit.

Constant conditional expression  

Reports conditional expressions with boolean constant as a condition.

Constant if statement  

Reports if statements with boolean constant as a condition.

Fallthrough in 'switch' statement  

Reports fallthrough in switch statements.

Final variable access  

Reports uninitialized final fields, invalid assignments to final variables, and parameters and fields.

If statement with identical branches  

Reports if statements with identical "then" and else branches.

If statement with too many branches  

Reports if statements with too many branches.

Loop statement that doesn't loop  

Reports for or while statements whose bodies are guaranteed to execute at most once.

Redundant 'if' statement  

Reports if statements which can be simplified to single assignment or return statements.

Redundant conditional expression  

Reports ternary conditional operators of the form x ? true : false or similar, which can be trivially simplified.

Switch statement with no default case  

Reports switch statements that do not contain default labels.

Ternary expression can be replaced with elvis expression  

Reports ternary expressions which can be replaced by an elvis expression.

Ternary expression can be replaced with safe call  

Reports ternary expressions which can be replaced by a safe call.

Ternary expression with identical branches  

Reports ternary expressions with identical "then" and "else" branches.

Unnecessary 'continue' statement  

Reports continue statements if they are last reachable statements in the loop.

Unnecessary 'return' statement  

Reports return statements at the end of constructors and methods returning void.

Last modified: 18 June 2024