Skip to content

JS: Promote js/loop-iteration-skipped-due-to-shifting to the Code Quality suite #19743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Napalys
Copy link
Contributor

@Napalys Napalys commented Jun 12, 2025

The following pull request makes changes to js/loop-iteration-skipped-due-to-shifting:

  • Promotes it to quality suite.
  • Fixed false positives when splice is used as a condition that adjusts the loop counter.
  • Added a test for a false positive that isn’t worth fixing.

MRVA shows good results (61 out of which most are true positives). Autofix seems to be able to do the job, it even marked the false positive which I have mentioned before as false positive 🤯

@Napalys Napalys marked this pull request as ready for review June 12, 2025 13:35
@Copilot Copilot AI review requested due to automatic review settings June 12, 2025 13:35
@Napalys Napalys requested a review from a team as a code owner June 12, 2025 13:35
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 reliability and correctness lines 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant