Skip to content

Commit 74dd782

Browse files
authored
Merge branch 'main' into mergeback/v1.1.1-to-main-ec300a31
2 parents b83cccd + 78e09bd commit 74dd782

File tree

6 files changed

+21
-50
lines changed

6 files changed

+21
-50
lines changed

lib/codeql.js

Lines changed: 6 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/codeql.ts

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ import * as path from "path";
44
import * as toolrunner from "@actions/exec/lib/toolrunner";
55
import { IHeaders } from "@actions/http-client/interfaces";
66
import { default as deepEqual } from "fast-deep-equal";
7-
import * as yaml from "js-yaml";
87
import { default as queryString } from "query-string";
98
import * as semver from "semver";
109

1110
import { isRunningLocalAction, getRelativeScriptPath } from "./actions-util";
1211
import * as api from "./api-client";
13-
import { Config, PackWithVersion } from "./config-utils";
12+
import { PackWithVersion } from "./config-utils";
1413
import * as defaults from "./defaults.json"; // Referenced from codeql-action-sync-tool!
1514
import { errorMatchers } from "./error-matcher";
1615
import { isTracedLanguage, Language } from "./languages";
@@ -81,7 +80,8 @@ export interface CodeQL {
8180
* Run 'codeql database init --db-cluster'.
8281
*/
8382
databaseInitCluster(
84-
config: Config,
83+
databasePath: string,
84+
languages: Language[],
8585
sourceRoot: string,
8686
processName: string | undefined,
8787
processLevel: number | undefined
@@ -220,7 +220,6 @@ const CODEQL_VERSION_GROUP_RULES = "2.5.5";
220220
const CODEQL_VERSION_SARIF_GROUP = "2.5.3";
221221
export const CODEQL_VERSION_COUNTS_LINES = "2.6.2";
222222
const CODEQL_VERSION_CUSTOM_QUERY_HELP = "2.7.1";
223-
const CODEQL_VERSION_CONFIG_FILES = "2.7.3";
224223
export const CODEQL_VERSION_ML_POWERED_QUERIES = "2.7.5";
225224

226225
/**
@@ -693,35 +692,26 @@ async function getCodeQLForCmd(
693692
]);
694693
},
695694
async databaseInitCluster(
696-
config: Config,
695+
databasePath: string,
696+
languages: Language[],
697697
sourceRoot: string,
698698
processName: string | undefined,
699699
processLevel: number | undefined
700700
) {
701-
const extraArgs = config.languages.map(
702-
(language) => `--language=${language}`
703-
);
704-
if (config.languages.filter(isTracedLanguage).length > 0) {
701+
const extraArgs = languages.map((language) => `--language=${language}`);
702+
if (languages.filter(isTracedLanguage).length > 0) {
705703
extraArgs.push("--begin-tracing");
706704
if (processName !== undefined) {
707705
extraArgs.push(`--trace-process-name=${processName}`);
708706
} else {
709-
// We default to 3 if no other arguments are provided since this was the default
710-
// behaviour of the Runner. Note this path never happens in the CodeQL Action
711-
// because that always passes in a process name.
712707
extraArgs.push(`--trace-process-level=${processLevel || 3}`);
713708
}
714709
}
715-
if (await util.codeQlVersionAbove(codeql, CODEQL_VERSION_CONFIG_FILES)) {
716-
const configLocation = path.resolve(config.tempDir, "user-config.yaml");
717-
fs.writeFileSync(configLocation, yaml.dump(config.originalUserInput));
718-
extraArgs.push(`--codescanning-config=${configLocation}`);
719-
}
720710
await runTool(cmd, [
721711
"database",
722712
"init",
723713
"--db-cluster",
724-
config.dbLocation,
714+
databasePath,
725715
`--source-root=${sourceRoot}`,
726716
...extraArgs,
727717
...getExtraOptionsFromEnv(["database", "init"]),
@@ -874,9 +864,7 @@ async function getCodeQLForCmd(
874864
if (extraSearchPath !== undefined) {
875865
codeqlArgs.push("--additional-packs", extraSearchPath);
876866
}
877-
if (!(await util.codeQlVersionAbove(this, CODEQL_VERSION_CONFIG_FILES))) {
878-
codeqlArgs.push(querySuitePath);
879-
}
867+
codeqlArgs.push(querySuitePath);
880868
await runTool(cmd, codeqlArgs);
881869
},
882870
async databaseInterpretResults(
@@ -911,10 +899,7 @@ async function getCodeQLForCmd(
911899
) {
912900
codeqlArgs.push("--sarif-category", automationDetailsId);
913901
}
914-
codeqlArgs.push(databasePath);
915-
if (!(await util.codeQlVersionAbove(this, CODEQL_VERSION_CONFIG_FILES))) {
916-
codeqlArgs.push(...querySuitePaths);
917-
}
902+
codeqlArgs.push(databasePath, ...querySuitePaths);
918903
// capture stdout, which contains analysis summaries
919904
return await runTool(cmd, codeqlArgs);
920905
},

src/init.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ export async function runInit(
9595
if (await codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING)) {
9696
// Init a database cluster
9797
await codeql.databaseInitCluster(
98-
config,
98+
config.dbLocation,
99+
config.languages,
99100
sourceRoot,
100101
processName,
101102
processLevel

0 commit comments

Comments
 (0)