Skip to content

C++: Fill gaps in query tests (part 2) - #22729

Merged
geoffw0 merged 4 commits into
github:mainfrom
geoffw0:qualitytests2
Oct 2, 2026
Merged

geoffw0 merged 4 commits into
github:mainfrom
geoffw0:qualitytests2

Conversation

@geoffw0

@geoffw0 geoffw0 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Fill gaps in CPP query tests, with quality queries in mind. The first three commits were generated with an AI agent (with quite a bit of context leading up to it), then I did a fourth commit adjusting and simplifying.

geoffw0 and others added 4 commits October 1, 2026 14:35
Cover blocks with four sufficiently large nested loops and the three-loop boundary for cpp/complex-block.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Exercise alternating logical operations above and at the reporting threshold for cpp/complex-condition.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Exercise multiple forward and backward targets and a single forward target for cpp/use-of-goto.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@geoffw0 geoffw0 added the C++ label Oct 1, 2026
@geoffw0
geoffw0 requested a review from a team as a code owner October 1, 2026 18:01
@geoffw0 geoffw0 added the no-change-note-required This PR does not need a change note label Oct 1, 2026
Copilot AI balanced review requested due to automatic review settings October 1, 2026 18:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The fixtures do not adequately cover several query thresholds and independent predicate boundaries.

Review effort: Balanced
Findings: 3 Medium severity

Open (3)
What changed in this PR

Adds query tests for three existing C++ best-practice queries.

Changes:

  • Adds positive and negative C++ fixtures.
  • Registers inline-expectation postprocessing.
  • Adds generated expected results.
File Description
UseOfGoto/​UseOfGoto.qlref Registers the goto query test.
UseOfGoto/​UseOfGoto.expected Records expected goto alert.
UseOfGoto/​UseOfGoto.cpp Adds goto test cases.
ComplexCondition/​ComplexCondition.qlref Registers the condition query test.
ComplexCondition/​ComplexCondition.expected Records expected complexity alert.
ComplexCondition/​ComplexCondition.cpp Adds condition test cases.
BlockWithTooManyStatements/​BlockWithTooManyStatements.qlref Registers the block query test.
BlockWithTooManyStatements/​BlockWithTooManyStatements.expected Records expected block alert.
BlockWithTooManyStatements/​BlockWithTooManyStatements.cpp Adds block-complexity test cases.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cpp/ql/test/query-tests/Best Practices/UseOfGoto/UseOfGoto.cpp

@jketema jketema left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@geoffw0
geoffw0 merged commit 6c0497c into github:main Oct 2, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C++ no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants