Skip to content

Commit

Permalink
Merge pull request #1010 from github/henrymercer/stop-running-ml-powe…
Browse files Browse the repository at this point in the history
…red-queries-on-windows

Stop running ML-powered queries on Windows
  • Loading branch information
henrymercer authored Mar 30, 2022
2 parents 894face + e6f3e04 commit 9dcc141
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
5 changes: 4 additions & 1 deletion lib/config-utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/config-utils.js.map

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions lib/config-utils.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/config-utils.test.js.map

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions src/config-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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/[email protected]",
"security-and-quality",
"0.0.1"
process.platform === "win32" ? undefined : "0.0.1"
);
2 changes: 2 additions & 0 deletions src/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9dcc141

Please sign in to comment.