Inspection Details

LineLabelNotUsed


Summary
Identifies line labels that are never referenced, and therefore superfluous.
Reasoning
Line labels are useful for GoTo, GoSub, Resume, and On Error statements; but the intent of a line label can be confusing if it isn't referenced by any such instruction.
The following code example(s) would trigger this inspection:

Public Sub DoSomething()
    ' On Error GoTo ErrHandler ' (commented-out On Error statement leaves line label unreferenced)
    ' ...
    Exit Sub
    ErrHandler:
    ' ...
End Sub

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

Public Sub DoSomething()
    On Error GoTo ErrHandler
    ' ...
    Exit Sub
    ErrHandler:
    ' ...
End Sub


Back to List