Constant Not Used

Locates 'Const' declarations that are never referenced.

Reasoning

Declarations that are never used should be removed.

Default severity

Warning

Inspection type

CodeQualityIssues

Examples

This example should trigger a result

MyModule (StandardModule)
Private Const foo As Long = 42 Public Sub DoSomething() ' no reference to 'foo' anywhere... End Sub

This example should NOT trigger a result

MyModule (StandardModule)
Private Const foo As Long = 42 Public Sub DoSomething() Debug.Print foo End Sub

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