Empty Case Block

Identifies empty 'Case' blocks that can be safely removed.

Reasoning

Case blocks in VBA do not "fall through"; an empty 'Case' block might be hiding a bug.

Default severity

Warning

Inspection type

NamingAndConventionsIssues

Examples

This example should trigger a result

MyModule (StandardModule)
Public Sub DoSomething(ByVal foo As Long) Select Case foo Case 0 ' empty block Case Is > 0 Debug.Print foo ' does not run if foo is 0. End Select End Sub

This example should NOT trigger a result

MyModule (StandardModule)
Public Sub DoSomething(ByVal foo As Long) Select Case foo Case 0 '...code... Case Is > 0 '...code... End Select End Sub

Rubberduck.CodeAnalysis.Inspections.Concrete.EmptyCaseBlockInspection.cs (Prerelease-v2.5.9.6289)