Use the --resolve-query-specs parameter of pack download

This will allow the command to resolve packs with paths.

Also, use a more concise version of `tr`.
This commit is contained in:
Andrew Eisenberg 2022-04-29 10:54:01 -07:00
parent 06b15c22b1
commit 922dc2b976
14 changed files with 15 additions and 33 deletions

View file

@ -241,9 +241,8 @@ export async function runQueries(
logger.info("Performing analysis with custom CodeQL Packs.");
logger.startGroup(`Downloading custom packs for ${language}`);
const results = await codeql.packDownload(
removePackPath(packsWithVersion)
);
const results = await codeql.packDownload(packsWithVersion);
logger.info(
`Downloaded packs: ${results.packs
.map((r) => `${r.name}@${r.version || "latest"}`)
@ -499,16 +498,6 @@ async function injectLinesOfCode(
}
}
/**
* `codeql pack download` command does not support downloading pack specifiers with paths
* in them. This removes the path from the pack specifier.
* @param packsWithVersion array of pack specifiers, some of which may have paths in them
* @returns array of pack specifiers without paths
*/
function removePackPath(packsWithVersion: string[]) {
return packsWithVersion.map((pack) => pack.split(":")[0]);
}
function printLinesOfCodeSummary(
logger: Logger,
language: Language,