Skip to content

QL: Convert qlref tests to inline expectations#21988

Open
owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:ql/convert-qlref-tests-inline-expectations
Open

QL: Convert qlref tests to inline expectations#21988
owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:ql/convert-qlref-tests-inline-expectations

Conversation

@owen-mc

@owen-mc owen-mc commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

This was done by copilot.

There is an issue with ql/ql/test/queries/performance/MissingNoInline/Test.qll where auto-formatting it moves the comment to the wrong line. We may have to not convert that one.

Copilot AI review requested due to automatic review settings June 15, 2026 10:16
@owen-mc owen-mc requested a review from a team as a code owner June 15, 2026 10:16

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.

Pull request overview

This PR migrates a set of QL query tests from .expected-based validation to inline expectations by adding $ Alert markers in the test sources and enabling the InlineExpectationsTestQuery.ql post-processing step via .qlref files.

Changes:

  • Updated many .qlref files to add postprocess: utils/test/InlineExpectationsTestQuery.ql.
  • Added inline expectation markers (// $ Alert) throughout QL test inputs to indicate the expected result locations.
  • Converted (at least) one existing “negative fixture” qlref (QlRefInlineExpectations/Test3.qlref) to use inline expectations, which impacts the associated query test’s intent/baseline.
Show a summary per file
File Description
ql/ql/test/queries/style/ValidatePredicateGetReturns/ValidatePredicateGetReturns.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/ValidatePredicateGetReturns/test.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/UseSetLiteral/UseSetLiteral.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/UseSetLiteral/test.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/UseInstanceofExtension/UseInstanceofExtension.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/UseInstanceofExtension/Foo.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/SwappedParameterNames/Test.qll Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/SwappedParameterNames/SwappedParameterNames.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/RedundantOverride/RedundantOverride.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/RedundantOverride/RedundantOverride.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/RedundantImport/RedundantImport.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/RedundantImport/D.qll Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/RedundantCast/RedundantCast.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/RedundantCast/Foo.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/QlRefInlineExpectations/Test3.qlref Converted to inline expectations (affects negative-fixture behavior).
ql/ql/test/queries/style/OmittableExists/Test.qll Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/OmittableExists/OmittableExists.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/NonDocBlock/NonDocBlock.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/NonDocBlock/Foo.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/Misspelling/Test.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/Misspelling/Misspelling.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/MissingSecurityMetadata/testcases/BadNoSeverity.ql Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/MissingSecurityMetadata/testcases/BadNoSecurity.ql Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/MissingSecurityMetadata/MissingSecurityMetadata.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/MissingQualityMetadata/testcases/BadQualityReliabilityWrongToplevel.ql Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/MissingQualityMetadata/testcases/BadQualityNoToplevel.ql Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/MissingQualityMetadata/testcases/BadQualityMultipleTopLevel.ql Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/MissingQualityMetadata/testcases/BadQualityMaintainabilityWrongToplevel.ql Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/MissingQualityMetadata/MissingQualityMetadata.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/MissingParameterInQlDoc/MissingParameterInQlDoc.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/MissingParameterInQlDoc/Foo.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/ImplicitThis/ImplicitThis.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/ImplicitThis/Bad2.qll Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/ImplicitThis/Bad.qll Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/FieldOnlyUsedInCharPred/FieldOnlyUsedInCharPred.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/FieldOnlyUsedInCharPred/FieldOnlyUsedInCharPred.qll Adds $ Alert marker for expected finding.
ql/ql/test/queries/style/DeadCode/Foo.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/DeadCode/DeadCode.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/DataFlowConfigModuleNaming/Test.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/DataFlowConfigModuleNaming/DataFlowConfigModuleNaming.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/CouldBeCast/Foo.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/CouldBeCast/CouldBeCast.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/style/AcronymsShouldBeCamelCase/Test.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/style/AcronymsShouldBeCamelCase/AcronymsShouldBeCamelCase.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/performance/VarUnusedInDisjunct/VarUnusedInDisjunct.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/performance/VarUnusedInDisjunct/Test.qll Adds $ Alert markers for expected findings.
ql/ql/test/queries/performance/MissingNoInline/Test.qll Adds $ Alert marker for expected finding.
ql/ql/test/queries/performance/MissingNoInline/MissingNoInline.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/performance/AbstractClassImport/AbstractClassImportTest1.qll Adds $ Alert marker for expected finding.
ql/ql/test/queries/performance/AbstractClassImport/AbstractClassImport.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/overlay/InlineOverlayCaller/Test.qll Adds $ Alert marker for expected finding.
ql/ql/test/queries/overlay/InlineOverlayCaller/InlineOverlayCaller.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/bugs/SumWithoutDomain/Test.qll Adds $ Alert marker for expected finding.
ql/ql/test/queries/bugs/SumWithoutDomain/SumWithoutDomain.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/bugs/OrderByConst/OrderByConst.qlref Enables inline-expectations postprocess for this test.
ql/ql/test/queries/bugs/OrderByConst/Foo.qll Adds $ Alert marker for expected finding.

Copilot's findings

  • Files reviewed: 56/56 changed files
  • Comments generated: 2

Comment on lines +1 to +2
query: ProblemQuery.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql
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.

3 participants