-
Notifications
You must be signed in to change notification settings - Fork 12
UnassignedVariableUsageInspection
###(disabled)
Description: Use of unassigned variable
Type: CodeInspectionType.CodeQualityIssues
Default severity: CodeInspectionSeverity.Error
This inspection finds all usages of unassigned variables.
###Example:
Field foo
is referenced, but it's never assigned.
Dim foo As Integer
Public Sub DoSomething()
Dim bar
bar = foo
End Sub
When a variable is used, but never assigned, it's unlikely that the code is doing what it should be doing. Note that this inspection will not catch whether a variable is actually assigned before it is used.
###QuickFixes
QuickFix: Remove usage (breaks code)
Dim foo As Integer
Public Sub DoSomething()
Dim bar
bar = TODO
End Sub
This quickfix replaces the unassigned reference with a TODO
placeholder that is meant to break the code - if there's actually a declared variable in-scope that's called TODO
, then this may be a problem. Otherwise, the idea is to put the code in a state that clearly needs to be addressed, as opposed to a state that merely compiles, but doesn't work as intended.