mirror of
https://github.com/github/codeql.git
synced 2026-04-10 17:44:03 +02:00
Some files that will change in #1736 have been spared. ./build -j4 target/jars/qlformat find ql/cpp/ql -name "*.ql" -print0 | xargs -0 target/jars/qlformat --input find ql/cpp/ql -name "*.qll" -print0 | xargs -0 target/jars/qlformat --input (cd ql && git checkout 'cpp/ql/src/semmle/code/cpp/ir/implementation/**/*SSA*.qll') buildutils-internal/scripts/pr-checks/sync-identical-files.py --latest
20 lines
727 B
Plaintext
20 lines
727 B
Plaintext
/**
|
|
* @name Nested loops with same variable
|
|
* @description When a nested loop uses the same iteration variable as its outer loop, the
|
|
* behavior of the outer loop easily becomes difficult to understand as the
|
|
* inner loop will affect its control flow. It is likely to be a typo.
|
|
* @kind problem
|
|
* @problem.severity warning
|
|
* @precision medium
|
|
* @id cpp/nested-loops-with-same-variable
|
|
* @tags maintainability
|
|
* correctness
|
|
*/
|
|
|
|
import NestedLoopSameVar
|
|
|
|
from ForStmt inner, Variable iteration, ForStmt outer
|
|
where nestedForViolation(inner, iteration, outer)
|
|
select inner.getCondition(), "Nested for statement uses loop variable $@ of enclosing $@.",
|
|
iteration, iteration.getName(), outer, "for statement"
|