Fork me on GitHub
TypeName RemoveRedundantElseClauseAnalyzer
Check Id CC0089
Category Usage
Severity Info

Cause

Certain if-else conditions can safely have their else clause removed.

Example

if (true)
{
    //some statement (not a comment)
}
else
{
}

Code fix

A code fix will be presented to you that will transform the code, it will remove completely the else statement if there’s no significant(not commented) code inside it.

if (true)
{
    //some statement (not a comment)
}

Code fix

Related rules

See also

TBD