Skip to content

Commit 9f22da4

Browse files
committed
JS: rename query to "Loop iteration skipped due to shifting"
1 parent 8c3b44a commit 9f22da4

11 files changed

+10
-10
lines changed

change-notes/1.20/analysis-javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| Double escaping or unescaping (`js/double-escaping`) | correctness, security, external/cwe/cwe-116 | Highlights potential double escaping or unescaping of special characters, indicating a possible violation of [CWE-116](https://cwe.mitre.org/data/definitions/116.html). Results are shown on LGTM by default. |
1414
| Incomplete URL substring sanitization | correctness, security, external/cwe/cwe-020 | Highlights URL sanitizers that are likely to be incomplete, indicating a violation of [CWE-020](https://cwe.mitre.org/data/definitions/20.html). Results shown on LGTM by default. |
1515
| Incorrect suffix check (`js/incorrect-suffix-check`) | correctness, security, external/cwe/cwe-020 | Highlights error-prone suffix checks based on `indexOf`, indicating a potential violation of [CWE-20](https://cwe.mitre.org/data/definitions/20.html). Results are shown on LGTM by default. |
16-
| Missing index adjustment after concurrent modification (`js/missing-index-adjustment-after-concurrent-modification`) | correctness | Highlights code that removes an element from an array while iterating over it, causing the loop to skip over some elements. Results are shown on LGTM by default. |
16+
| Loop iteration skipped due to shifting (`js/loop-iteration-skipped-due-to-shifting`) | correctness | Highlights code that removes an element from an array while iterating over it, causing the loop to skip over some elements. Results are shown on LGTM by default. |
1717
| Useless comparison test (`js/useless-comparison-test`) | correctness | Highlights code that is unreachable due to a numeric comparison that is always true or always false. Results are shown on LGTM by default. |
1818

1919
## Changes to existing queries

javascript/ql/src/Statements/MissingIndexAdjustmentAfterConcurrentModification.qhelp renamed to javascript/ql/src/Statements/LoopIterationSkippedDueToShifting.qhelp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Determine what the loop is supposed to do:
3838
In this example, a function is intended to remove "<code>..</code>" parts from a path:
3939
</p>
4040

41-
<sample src="examples/MissingIndexAdjustmentAfterConcurrentModification.js" />
41+
<sample src="examples/LoopIterationSkippedDueToShifting.js" />
4242

4343
<p>
4444
However, whenever the input contain two "<code>..</code>" parts right after one another, only the first will be removed.
@@ -51,13 +51,13 @@ index 0 and will therefore be skipped.
5151
One way to avoid this is to decrement the loop counter after removing an element from the array:
5252
</p>
5353

54-
<sample src="examples/MissingIndexAdjustmentAfterConcurrentModificationGood.js" />
54+
<sample src="examples/LoopIterationSkippedDueToShiftingGood.js" />
5555

5656
<p>
5757
Alternatively, use the <code>filter</code> method:
5858
</p>
5959

60-
<sample src="examples/MissingIndexAdjustmentAfterConcurrentModificationGoodFilter.js" />
60+
<sample src="examples/LoopIterationSkippedDueToShiftingGoodFilter.js" />
6161

6262
</example>
6363
<references>

javascript/ql/src/Statements/MissingIndexAdjustmentAfterConcurrentModification.ql renamed to javascript/ql/src/Statements/LoopIterationSkippedDueToShifting.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/**
2-
* @name Missing index adjustment after concurrent modification
2+
* @name Loop iteration skipped due to shifting.
33
* @description Removing elements from an array while iterating over it can cause the loop to skip over some elements,
44
* unless the loop index is decremented accordingly.
55
* @kind problem
66
* @problem.severity warning
7-
* @id js/missing-index-adjustment-after-concurrent-modification
7+
* @id js/loop-iteration-skipped-due-to-shifting
88
* @tags correctness
99
* @precision high
1010
*/

javascript/ql/src/Statements/examples/MissingIndexAdjustmentAfterConcurrentModification.js renamed to javascript/ql/src/Statements/examples/LoopIterationSkippedDueToShifting.js

File renamed without changes.

javascript/ql/src/Statements/examples/MissingIndexAdjustmentAfterConcurrentModificationGood.js renamed to javascript/ql/src/Statements/examples/LoopIterationSkippedDueToShiftingGood.js

File renamed without changes.

javascript/ql/src/Statements/examples/MissingIndexAdjustmentAfterConcurrentModificationGoodFilter.js renamed to javascript/ql/src/Statements/examples/LoopIterationSkippedDueToShiftingGoodFilter.js

File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| 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. |
2+
| 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. |
3+
| 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. |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Statements/LoopIterationSkippedDueToShifting.ql

javascript/ql/test/query-tests/Statements/MissingIndexAdjustmentAfterConcurrentModification/tst.js renamed to javascript/ql/test/query-tests/Statements/LoopIterationSkippedDueToShifting/tst.js

File renamed without changes.

javascript/ql/test/query-tests/Statements/MissingIndexAdjustmentAfterConcurrentModification/MissingIndexAdjustmentAfterConcurrentModification.expected

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)