mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
JS: add test cases for false positives in loop-iteration-skipped-due-to-shifting
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
| tst.js:4:27:4:44 | parts.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
| tst.js:13:29:13:46 | parts.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
| tst.js:24:9:24:26 | parts.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
| tst.js:128:11:128:33 | pending ... e(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
| tst.js:136:32:136:47 | toc.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
| tst.js:143:10:143:25 | toc.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent array item to be skipped. |
|
||||
|
||||
@@ -121,3 +121,28 @@ function inspectNextElement(string) {
|
||||
}
|
||||
return parts.join('/');
|
||||
}
|
||||
|
||||
function withTryCatch(pendingCSS) {
|
||||
for (let i = 0; i < pendingCSS.length; ++i) {
|
||||
try {
|
||||
pendingCSS.splice(i, 1); // $ SPURIOUS:Alert
|
||||
i -= 1;
|
||||
} catch (ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
function andOperand(toc) {
|
||||
for (let i = 0; i < toc.length; i++) {
|
||||
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--; // $ SPURIOUS:Alert
|
||||
}
|
||||
}
|
||||
|
||||
function ifStatement(toc) {
|
||||
for (let i = 0; i < toc.length; i++) {
|
||||
if(toc[i].ignoreSubHeading){
|
||||
if(toc.splice(i, 1)){ // $ SPURIOUS:Alert
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user