Run version ~0.2.0 of the ML-powered query pack for v2.8.4+ of the CLI

This commit is contained in:
Henry Mercer 2022-03-31 14:42:52 +01:00
parent 2c03704a6c
commit e26813cf98
6 changed files with 21 additions and 7 deletions

View file

@ -925,4 +925,6 @@ const mlPoweredQueriesMacro = ava_1.default.macro({
(0, ava_1.default)(mlPoweredQueriesMacro, "2.7.5", true, undefined, "security-and-quality", process.platform === "win32" ? undefined : "~0.1.0");
// Test that we don't inject an ML-powered query pack if the user has already specified one.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.7.5", true, "codeql/javascript-experimental-atm-queries@0.0.1", "security-and-quality", process.platform === "win32" ? undefined : "0.0.1");
// Test that the ~0.2.0 version of ML-powered queries is run on v2.8.4 of the CLI.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.8.4", true, undefined, "security-extended", process.platform === "win32" ? undefined : "~0.2.0");
//# sourceMappingURL=config-utils.test.js.map

File diff suppressed because one or more lines are too long

7
lib/util.js generated
View file

@ -550,9 +550,10 @@ exports.ML_POWERED_JS_QUERIES_PACK_NAME = "codeql/javascript-experimental-atm-qu
* Gets the ML-powered JS query pack to add to the analysis if a repo is opted into the ML-powered
* queries beta.
*/
async function getMlPoweredJsQueriesPack(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_codeQL) {
async function getMlPoweredJsQueriesPack(codeQL) {
if (await codeQlVersionAbove(codeQL, "2.8.4")) {
return { packName: exports.ML_POWERED_JS_QUERIES_PACK_NAME, version: "~0.2.0" };
}
return { packName: exports.ML_POWERED_JS_QUERIES_PACK_NAME, version: "~0.1.0" };
}
exports.getMlPoweredJsQueriesPack = getMlPoweredJsQueriesPack;

File diff suppressed because one or more lines are too long

View file

@ -1837,3 +1837,12 @@ test(
"security-and-quality",
process.platform === "win32" ? undefined : "0.0.1"
);
// Test that the ~0.2.0 version of ML-powered queries is run on v2.8.4 of the CLI.
test(
mlPoweredQueriesMacro,
"2.8.4",
true,
undefined,
"security-extended",
process.platform === "win32" ? undefined : "~0.2.0"
);

View file

@ -661,9 +661,11 @@ export const ML_POWERED_JS_QUERIES_PACK_NAME =
* queries beta.
*/
export async function getMlPoweredJsQueriesPack(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_codeQL: CodeQL
codeQL: CodeQL
): Promise<PackWithVersion> {
if (await codeQlVersionAbove(codeQL, "2.8.4")) {
return { packName: ML_POWERED_JS_QUERIES_PACK_NAME, version: "~0.2.0" };
}
return { packName: ML_POWERED_JS_QUERIES_PACK_NAME, version: "~0.1.0" };
}