Inspection Details

EmptyIfBlock


Summary
Identifies empty 'If' blocks.
Reasoning
Conditional expression is inverted; there would not be a need for an 'Else' block otherwise.
The following code example(s) would trigger this inspection:

Public Sub DoSomething(ByVal foo As Boolean)
    If foo Then
    Else
        ' ...
    End If
End Sub

The following code example(s) would not trigger this inspection:

Public Sub DoSomething(ByVal foo As Boolean)
    If Not foo Then
        ' ...
    End If
End Sub


Back to List