CodeQL library for JavaScript/TypeScript
codeql/javascript-all 2.1.1-dev (changelog, source)
Search

Predicate unusedIndexVariable

Holds if rel is a for-loop condition of the form idx <= v.length, but all array indices v[c] inside the loop body (of which there must be at least one) use a constant index c instead of an index based on idx.

Import path

import LanguageFeatures.UnusedIndexVariable
predicate unusedIndexVariable(RelationalComparison rel, Variable idx, Variable v)