Query module SuspiciousUnusedLoopIterationVariable

name
Suspicious unused loop iteration variable
description
A loop iteration variable is unused, which suggests an error.
kind
problem
tags
maintainability correctness
problem.severity
error
sub-severity
low
precision
high
id
py/unused-loop-variable

Imports

Predicates

counting_loop
empty_loop
get_comp_iterable

Get the CFG node for the iterable relating to the for-statement f in a comprehension. The for-statement f is the artificial for-statement in a comprehension and the result is the iterable in that comprehension. E.g. gets x from { y for y in x }.

implicit_repeat

Whether loop body is implicitly repeating something N times. E.g. queue.add(None)

is_increment
one_item_only
points_to_call_to_range
use_of_non_constant

Whether n is a use of a variable that is a not effectively a constant.