Add external git repositories to search path for custom queries

This commit is contained in:
Edoardo Pirovano 2021-04-01 12:38:13 +01:00 committed by Edoardo Pirovano
parent 1fa35632f2
commit 578f9fc99e
15 changed files with 244 additions and 100 deletions

View file

@ -90,6 +90,7 @@ export interface CodeQL {
databaseAnalyze(
databasePath: string,
sarifFile: string,
extraSearchPath: string | undefined,
querySuite: string,
memoryFlag: string,
addSnippetsFlag: string,
@ -640,12 +641,13 @@ function getCodeQLForCmd(cmd: string): CodeQL {
async databaseAnalyze(
databasePath: string,
sarifFile: string,
extraSearchPath: string | undefined,
querySuite: string,
memoryFlag: string,
addSnippetsFlag: string,
threadsFlag: string
) {
await new toolrunner.ToolRunner(cmd, [
const args = [
"database",
"analyze",
memoryFlag,
@ -657,8 +659,12 @@ function getCodeQLForCmd(cmd: string): CodeQL {
`--output=${sarifFile}`,
addSnippetsFlag,
...getExtraOptionsFromEnv(["database", "analyze"]),
querySuite,
]).exec();
];
if (extraSearchPath !== undefined) {
args.push("--search-path", extraSearchPath);
}
args.push(querySuite);
await new toolrunner.ToolRunner(cmd, args).exec();
},
};
}