JS: Promote js/loop-iteration-skipped-due-to-shifting to the Code Quality suite#19743
Merged
Napalys merged 9 commits intogithub:mainfrom Jun 20, 2025
Merged
JS: Promote js/loop-iteration-skipped-due-to-shifting to the Code Quality suite#19743Napalys merged 9 commits intogithub:mainfrom
js/loop-iteration-skipped-due-to-shifting to the Code Quality suite#19743Napalys merged 9 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR promotes the js/loop-iteration-skipped-due-to-shifting query to the Code Quality suite, refines its false-positive logic, and adds corresponding tests.
- Updated query metadata and suite inclusion for Code Quality promotion
- Excluded splice calls used in conditional guards from false positives
- Extended tests and expected results for both true positives and a retained false positive
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| javascript/ql/test/query-tests/Statements/LoopIterationSkippedDueToShifting/tst.js | Added test functions covering try/catch, logical-and, and if‐guards |
| javascript/ql/test/query-tests/Statements/LoopIterationSkippedDueToShifting/LoopIterationSkippedDueToShifting.expected | Added expected alerts for new true-positive cases |
| javascript/ql/src/change-notes/2025-06-12-loop-iteration.md | Documented addition of reliability tag |
| javascript/ql/src/change-notes/2025-06-12-loop-iteration-fix.md | Noted fix for false positives when splice is used in conditions |
| javascript/ql/src/Statements/LoopIterationSkippedDueToShifting.ql | Changed tags to quality, added guard to skip splice-in-condition |
| javascript/ql/integration-tests/query-suite/javascript-code-quality.qls.expected | Included the query in the JavaScript Code Quality suite |
Comments suppressed due to low confidence (2)
javascript/ql/src/Statements/LoopIterationSkippedDueToShifting.ql:9
- The
reliabilityandcorrectnesslines aren’t prefixed with@tags, so they may not be recognized. Consider combining all tags on one annotation, e.g.* @tags quality reliability correctness.
* reliability
javascript/ql/src/change-notes/2025-06-12-loop-iteration.md:4
- [nitpick] Since the PR also promotes this query to the Code Quality suite, consider adding a bullet note about that promotion to keep change-notes in sync with the integration-test update.
* The `js/loop-iteration-skipped-due-to-shifting` query has been updated with `reliability` tag.
tausbn
requested changes
Jun 19, 2025
Contributor
tausbn
left a comment
There was a problem hiding this comment.
A few comments and suggestions, otherwise this looks good to me! 👍
Co-authored-by: Taus <tausbn@github.com>
Co-authored-by: Taus <tausbn@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The following pull request makes changes to
js/loop-iteration-skipped-due-to-shifting:spliceis used as a condition that adjusts the loop counter.MRVA shows good results (61 out of which most are true positives).
Autofixseems to be able to do the job, it even marked the false positive which I have mentioned before as false positive 🤯