-
Notifications
You must be signed in to change notification settings - Fork 302
VariableNotAssignedInspection
Mathieu Guindon edited this page Feb 23, 2015
·
2 revisions
Description: Variable is never assigned
Type: CodeInspectionType.CodeQualityIssues
Default severity: CodeInspectionSeverity.Hint
This inspection finds global-scope, module-scope and procedure-scope variables that are never assigned to.
###Example:
Variable foo
is never assigned in this procedure:
Public Sub DoSomething()
Dim foo As Integer
DoSomethingElse 42
End Sub
Declarations of unassigned variables can be safely removed. Usages of unassigned variables are likely bugs.
###QuickFixes
QuickFix: Remove unassigned variable
Public Sub DoSomething()
DoSomethingElse 42
End Sub
This quickfix simply removes the unused declaration; if Option Explicit
is specified, doing this will break any/all usages of the unassigned variable. If Option Explicit
is not specified, removing the declaration has no effect.
rubberduckvba.com
© 2014-2021 Rubberduck project contributors
- Contributing
- Build process
- Version bump
- Architecture Overview
- IoC Container
- Parser State
- The Parsing Process
- How to view parse tree
- UI Design Guidelines
- Strategies for managing COM object lifetime and release
- COM Registration
- Internal Codebase Analysis
- Projects & Workflow
- Adding other Host Applications
- Inspections XML-Doc
-
VBE Events