Skip to content

Unused local variable (UnusedLocalVariable)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Code smell BSL
OS
Major Yes 1 brainoverload
badpractice
unused

Description

Unused local variables should be removed

If a local variable is declared but not used, it is dead code and should be removed. Doing so will improve maintainability because developers will not wonder what the variable is used for.

Snippets

Diagnostic ignorance in code

// BSLLS:UnusedLocalVariable-off
// BSLLS:UnusedLocalVariable-on

Parameter for config

"UnusedLocalVariable": false