Move Field Closer to Usage
Locates module-level fields that can be moved to a smaller scope.
Reasoning
Module-level variables that are only used in a single procedure can often be declared in that procedure's scope. Declaring variables closer to where they are used generally makes the code easier to follow.
Default severity
Hint
Inspection type
NamingAndConventionsIssues
Examples
This example should trigger a result
This example should NOT trigger a result
Rubberduck.CodeAnalysis.Inspections.Concrete.MoveFieldCloserToUsageInspection.cs (Prerelease-v2.5.9.6289)