correctness.logic

Off-by-one error in loop boundaries

Index-based loops should not skip the first element or iterate one step past the collection boundary.

#Metadata

#Why it matters

Off-by-one loop conditions frequently cause undefined reads, missed work, or stale guard logic around array bounds.

#Remediation

Use `< collection.length` for ascending loops and `>= 0` for descending loops that start at `length - 1`.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/typescript/ts.correctness.off-by-one-loop-boundary.rule.yaml.