QL: Convert qlref tests to inline expectations#21988
Open
owen-mc wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
.qlreffiles to addpostprocess: 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 |
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.
This was done by copilot.
There is an issue with
ql/ql/test/queries/performance/MissingNoInline/Test.qllwhere auto-formatting it moves the comment to the wrong line. We may have to not convert that one.