Skip to content

Commit

Permalink
Showing 9 changed files with 40 additions and 20 deletions.
3 changes: 2 additions & 1 deletion lib/codeql.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/codeql.js.map

Large diffs are not rendered by default.

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.

18 changes: 11 additions & 7 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.

1 change: 1 addition & 0 deletions src/codeql.ts
@@ -215,6 +215,7 @@ const CODEQL_VERSION_GROUP_RULES = "2.5.5";
const CODEQL_VERSION_SARIF_GROUP = "2.5.3";
export const CODEQL_VERSION_COUNTS_LINES = "2.6.2";
const CODEQL_VERSION_CUSTOM_QUERY_HELP = "2.7.1";
export const CODEQL_VERSION_ML_POWERED_QUERIES = "2.7.5";

/**
* This variable controls using the new style of tracing from the CodeQL
16 changes: 11 additions & 5 deletions src/config-utils.test.ts
@@ -1656,12 +1656,16 @@ test(

async function mlPoweredQueriesMacro(
t: ExecutionContext,
codeQLVersion: string,
isMlPoweredQueriesFlagEnabled: boolean,
queriesInput: string | undefined,
shouldRunMlPoweredQueries: boolean
) {
return await util.withTmpDir(async (tmpDir) => {
const codeQL = setCodeQL({
async getVersion() {
return codeQLVersion;
},
async resolveQueries() {
return {
byLanguage: {
@@ -1711,6 +1715,7 @@ async function mlPoweredQueriesMacro(

mlPoweredQueriesMacro.title = (
_providedTitle: string,
codeQLVersion: string,
isMlPoweredQueriesFlagEnabled: boolean,
queriesInput: string | undefined,
shouldRunMlPoweredQueries: boolean
@@ -1721,13 +1726,14 @@ mlPoweredQueriesMacro.title = (

return `ML-powered queries ${
shouldRunMlPoweredQueries ? "are" : "aren't"
} loaded for ${queriesInputDescription} when feature flag is ${
} loaded for ${queriesInputDescription} using CLI v${codeQLVersion} when feature flag is ${
isMlPoweredQueriesFlagEnabled ? "enabled" : "disabled"
}`;
};

// macro, isMlPoweredQueriesFlagEnabled, queriesInput, shouldRunMlPoweredQueries
test(mlPoweredQueriesMacro, false, "security-extended", false);
test(mlPoweredQueriesMacro, true, undefined, false);
test(mlPoweredQueriesMacro, true, "security-extended", true);
test(mlPoweredQueriesMacro, true, "security-and-quality", true);
test(mlPoweredQueriesMacro, "2.7.4", true, "security-extended", false);
test(mlPoweredQueriesMacro, "2.7.5", false, "security-extended", false);
test(mlPoweredQueriesMacro, "2.7.5", true, undefined, false);
test(mlPoweredQueriesMacro, "2.7.5", true, "security-extended", true);
test(mlPoweredQueriesMacro, "2.7.5", true, "security-and-quality", true);
11 changes: 8 additions & 3 deletions src/config-utils.ts
@@ -5,13 +5,17 @@ import * as yaml from "js-yaml";
import * as semver from "semver";

import * as api from "./api-client";
import { CodeQL, ResolveQueriesOutput } from "./codeql";
import {
CodeQL,
CODEQL_VERSION_ML_POWERED_QUERIES,
ResolveQueriesOutput,
} from "./codeql";
import * as externalQueries from "./external-queries";
import { FeatureFlag, FeatureFlags } from "./feature-flags";
import { Language, parseLanguage } from "./languages";
import { Logger } from "./logging";
import { RepositoryNwo } from "./repository";
import { GitHubVersion } from "./util";
import { codeQlVersionAbove, GitHubVersion } from "./util";

// Property names from the user-supplied config file.
const NAME_PROPERTY = "name";
@@ -279,7 +283,8 @@ async function addBuiltinSuiteQueries(
if (
languages.includes("javascript") &&
(found === "security-extended" || found === "security-and-quality") &&
(await featureFlags.getValue(FeatureFlag.MlPoweredQueriesEnabled))
(await featureFlags.getValue(FeatureFlag.MlPoweredQueriesEnabled)) &&
(await codeQlVersionAbove(codeQL, CODEQL_VERSION_ML_POWERED_QUERIES))
) {
if (!packs.javascript) {
packs.javascript = [];

0 comments on commit 2159631

Please sign in to comment.