Merge remote-tracking branch 'upstream/main' into aeisenberg/remove-queries

This commit is contained in:
Andrew Eisenberg 2022-06-15 17:21:05 -07:00
commit 6db77eec0d
6 changed files with 54 additions and 5 deletions

View file

@ -965,4 +965,10 @@ const mlPoweredQueriesMacro = ava_1.default.macro({
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.0", true, undefined, "security-and-quality", "~0.2.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.9.0", true, "codeql/javascript-experimental-atm-queries@0.0.1", "security-and-quality", "0.0.1");
// Test that ML-powered queries are run on all platforms running `security-extended` on CodeQL
// CLI 2.9.3+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.3", true, undefined, "security-extended", "~0.3.0");
// Test that ML-powered queries are run on all platforms running `security-and-quality` on CodeQL
// CLI 2.9.3+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.3", true, undefined, "security-and-quality", "~0.3.0");
//# sourceMappingURL=config-utils.test.js.map

File diff suppressed because one or more lines are too long

10
lib/util.js generated
View file

@ -553,6 +553,7 @@ exports.ML_POWERED_JS_QUERIES_PACK_NAME = "codeql/javascript-experimental-atm-qu
* queries beta.
*/
async function getMlPoweredJsQueriesPack(codeQL) {
<<<<<<< HEAD
const version = (await codeQlVersionAbove(codeQL, "2.8.4"))
? "~0.2.0"
: "~0.1.0";
@ -560,6 +561,15 @@ async function getMlPoweredJsQueriesPack(codeQL) {
name: exports.ML_POWERED_JS_QUERIES_PACK_NAME,
version,
});
=======
if (await codeQlVersionAbove(codeQL, "2.9.3")) {
return `${exports.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.3.0`;
}
else if (await codeQlVersionAbove(codeQL, "2.8.4")) {
return `${exports.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.2.0`;
}
return `${exports.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`;
>>>>>>> upstream/main
}
exports.getMlPoweredJsQueriesPack = getMlPoweredJsQueriesPack;
/**

File diff suppressed because one or more lines are too long

View file

@ -1919,3 +1919,23 @@ test(
"security-and-quality",
"0.0.1"
);
// Test that ML-powered queries are run on all platforms running `security-extended` on CodeQL
// CLI 2.9.3+.
test(
mlPoweredQueriesMacro,
"2.9.3",
true,
undefined,
"security-extended",
"~0.3.0"
);
// Test that ML-powered queries are run on all platforms running `security-and-quality` on CodeQL
// CLI 2.9.3+.
test(
mlPoweredQueriesMacro,
"2.9.3",
true,
undefined,
"security-and-quality",
"~0.3.0"
);

View file

@ -668,9 +668,14 @@ export const ML_POWERED_JS_QUERIES_PACK_NAME =
export async function getMlPoweredJsQueriesPack(
codeQL: CodeQL
): Promise<string> {
const version = (await codeQlVersionAbove(codeQL, "2.8.4"))
? "~0.2.0"
: "~0.1.0";
let version;
if (await codeQlVersionAbove(codeQL, "2.9.3")) {
version = `~0.3.0`;
} else if (await codeQlVersionAbove(codeQL, "2.8.4")) {
version = `~0.2.0`;
} else {
version = `~0.1.0`;
}
return prettyPrintPack({
name: ML_POWERED_JS_QUERIES_PACK_NAME,
version,