Query module InconsistentLoopOrientation

name
Inconsistent direction of for loop
description
A ‘for’ loop that increments its loop variable but checks it against a lower bound, or decrements its loop variable but checks it against an upper bound, will either stop iterating immediately or keep iterating indefinitely, and is usually indicative of a typo.
kind
problem
problem.severity
error
id
js/inconsistent-loop-direction
tags
correctness external/cwe/cwe-835
precision
very-high

Imports

javascript

Provides classes for working with JavaScript programs, as well as JSON, YAML and HTML.

Predicates

bounds

Holds if test bounds v in direction, which is either "upward" or "downward".

updates

Holds if upd updates v in direction, which is either "upward" or "downward".