Merge branch 'main' into henrymercer/update-actions-major-versions
This commit is contained in:
commit
1ea2f2d7f1
6 changed files with 30 additions and 11 deletions
5
lib/config-utils.js
generated
5
lib/config-utils.js
generated
|
|
@ -130,7 +130,10 @@ async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suite
|
|||
// If we're running the JavaScript security-extended analysis (or a superset of it), the repo is
|
||||
// opted into the ML-powered queries beta, and a user hasn't already added the ML-powered query
|
||||
// pack, then add the ML-powered query pack so that we run ML-powered queries.
|
||||
if (languages.includes("javascript") &&
|
||||
if (
|
||||
// Disable ML-powered queries on Windows
|
||||
process.platform !== "win32" &&
|
||||
languages.includes("javascript") &&
|
||||
(found === "security-extended" || found === "security-and-quality") &&
|
||||
!((_a = packs.javascript) === null || _a === void 0 ? void 0 : _a.some((pack) => pack.packName === util_1.ML_POWERED_JS_QUERIES_PACK.packName)) &&
|
||||
(await featureFlags.getValue(feature_flags_1.FeatureFlag.MlPoweredQueriesEnabled)) &&
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
15
lib/config-utils.test.js
generated
15
lib/config-utils.test.js
generated
|
|
@ -911,11 +911,18 @@ const mlPoweredQueriesMacro = ava_1.default.macro({
|
|||
? `${expectedVersionString} are`
|
||||
: "aren't"} loaded for packs: ${packsInput}, queries: ${queriesInput} using CLI v${codeQLVersion} when feature flag is ${isMlPoweredQueriesFlagEnabled ? "enabled" : "disabled"}`,
|
||||
});
|
||||
// macro, isMlPoweredQueriesFlagEnabled, packsInput, queriesInput, versionString
|
||||
// macro, codeQLVersion, isMlPoweredQueriesFlagEnabled, packsInput, queriesInput, expectedVersionString
|
||||
// Test that ML-powered queries aren't run on v2.7.4 of the CLI.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.7.4", true, undefined, "security-extended", undefined);
|
||||
// Test that ML-powered queries aren't run when the feature flag is off.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.7.5", false, undefined, "security-extended", undefined);
|
||||
// Test that ML-powered queries aren't run when the user hasn't specified that we should run the
|
||||
// `security-extended` or `security-and-quality` query suite.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.7.5", true, undefined, undefined, undefined);
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.7.5", true, undefined, "security-extended", "~0.1.0");
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.7.5", true, undefined, "security-and-quality", "~0.1.0");
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.7.5", true, "codeql/javascript-experimental-atm-queries@0.0.1", "security-and-quality", "0.0.1");
|
||||
// Test that ML-powered queries are run on non-Windows platforms running `security-extended`.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.7.5", true, undefined, "security-extended", process.platform === "win32" ? undefined : "~0.1.0");
|
||||
// Test that ML-powered queries are run on non-Windows platforms running `security-and-quality`.
|
||||
(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");
|
||||
//# sourceMappingURL=config-utils.test.js.map
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1788,7 +1788,8 @@ const mlPoweredQueriesMacro = test.macro({
|
|||
}`,
|
||||
});
|
||||
|
||||
// macro, isMlPoweredQueriesFlagEnabled, packsInput, queriesInput, versionString
|
||||
// macro, codeQLVersion, isMlPoweredQueriesFlagEnabled, packsInput, queriesInput, expectedVersionString
|
||||
// Test that ML-powered queries aren't run on v2.7.4 of the CLI.
|
||||
test(
|
||||
mlPoweredQueriesMacro,
|
||||
"2.7.4",
|
||||
|
|
@ -1797,6 +1798,7 @@ test(
|
|||
"security-extended",
|
||||
undefined
|
||||
);
|
||||
// Test that ML-powered queries aren't run when the feature flag is off.
|
||||
test(
|
||||
mlPoweredQueriesMacro,
|
||||
"2.7.5",
|
||||
|
|
@ -1805,28 +1807,33 @@ test(
|
|||
"security-extended",
|
||||
undefined
|
||||
);
|
||||
// Test that ML-powered queries aren't run when the user hasn't specified that we should run the
|
||||
// `security-extended` or `security-and-quality` query suite.
|
||||
test(mlPoweredQueriesMacro, "2.7.5", true, undefined, undefined, undefined);
|
||||
// Test that ML-powered queries are run on non-Windows platforms running `security-extended`.
|
||||
test(
|
||||
mlPoweredQueriesMacro,
|
||||
"2.7.5",
|
||||
true,
|
||||
undefined,
|
||||
"security-extended",
|
||||
"~0.1.0"
|
||||
process.platform === "win32" ? undefined : "~0.1.0"
|
||||
);
|
||||
// Test that ML-powered queries are run on non-Windows platforms running `security-and-quality`.
|
||||
test(
|
||||
mlPoweredQueriesMacro,
|
||||
"2.7.5",
|
||||
true,
|
||||
undefined,
|
||||
"security-and-quality",
|
||||
"~0.1.0"
|
||||
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.
|
||||
test(
|
||||
mlPoweredQueriesMacro,
|
||||
"2.7.5",
|
||||
true,
|
||||
"codeql/javascript-experimental-atm-queries@0.0.1",
|
||||
"security-and-quality",
|
||||
"0.0.1"
|
||||
process.platform === "win32" ? undefined : "0.0.1"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -299,6 +299,8 @@ async function addBuiltinSuiteQueries(
|
|||
// opted into the ML-powered queries beta, and a user hasn't already added the ML-powered query
|
||||
// pack, then add the ML-powered query pack so that we run ML-powered queries.
|
||||
if (
|
||||
// Disable ML-powered queries on Windows
|
||||
process.platform !== "win32" &&
|
||||
languages.includes("javascript") &&
|
||||
(found === "security-extended" || found === "security-and-quality") &&
|
||||
!packs.javascript?.some(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue