redefined-while-unused (F811)
Added in v0.0.171 · Related issues · View source
Derived from the Pyflakes linter.
Fix is sometimes available.
What it does
Checks for variable definitions that redefine (or "shadow") unused variables.
Why is this bad?
Redefinitions of unused names are unnecessary and often indicative of a mistake.
Example
Use instead:
Preview
When preview is enabled, this rule also flags annotated variable
redeclarations. For example, bar: int = 1 followed by bar: int = 2
will be flagged as a redefinition of an unused variable, whereas plain
reassignments like bar = 1 followed by bar = 2 remain unflagged.
Options
This rule ignores dummy variables, as determined by: