Start progress bar earlier
This commit is contained in:
@@ -215,42 +215,65 @@ export class VariantAnalysisManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async runVariantAnalysisFromPublishedPack(): Promise<void> {
|
private async runVariantAnalysisFromPublishedPack(): Promise<void> {
|
||||||
const language = await askForLanguage(this.cliServer);
|
return withProgress(async (progress, token) => {
|
||||||
|
progress({
|
||||||
|
maxStep: 8,
|
||||||
|
step: 0,
|
||||||
|
message: "Determining query language",
|
||||||
|
});
|
||||||
|
|
||||||
const packName = `codeql/${language}-queries`;
|
const language = await askForLanguage(this.cliServer);
|
||||||
const packDownloadResult = await this.cliServer.packDownload([packName]);
|
|
||||||
const downloadedPack = packDownloadResult.packs[0];
|
|
||||||
|
|
||||||
const packDir = join(
|
progress({
|
||||||
packDownloadResult.packDir,
|
maxStep: 8,
|
||||||
downloadedPack.name,
|
step: 1,
|
||||||
downloadedPack.version,
|
message: "Downloading query pack",
|
||||||
);
|
});
|
||||||
|
|
||||||
const suitePath = join(
|
const packName = `codeql/${language}-queries`;
|
||||||
packDir,
|
const packDownloadResult = await this.cliServer.packDownload([packName]);
|
||||||
"codeql-suites",
|
const downloadedPack = packDownloadResult.packs[0];
|
||||||
`${language}-code-scanning.qls`,
|
|
||||||
);
|
|
||||||
const resolvedQueries = await this.cliServer.resolveQueries(suitePath);
|
|
||||||
|
|
||||||
const problemQueries =
|
const packDir = join(
|
||||||
await this.filterToOnlyProblemQueries(resolvedQueries);
|
packDownloadResult.packDir,
|
||||||
|
downloadedPack.name,
|
||||||
if (problemQueries.length === 0) {
|
downloadedPack.version,
|
||||||
void this.app.logger.showErrorMessage(
|
|
||||||
`Unable to trigger variant analysis. No problem queries found in published query pack: ${packName}.`,
|
|
||||||
);
|
);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return withProgress((progress, token) =>
|
progress({
|
||||||
this.runVariantAnalysis(
|
maxStep: 8,
|
||||||
|
step: 2,
|
||||||
|
message: "Resolving queries in pack",
|
||||||
|
});
|
||||||
|
|
||||||
|
const suitePath = join(
|
||||||
|
packDir,
|
||||||
|
"codeql-suites",
|
||||||
|
`${language}-code-scanning.qls`,
|
||||||
|
);
|
||||||
|
const resolvedQueries = await this.cliServer.resolveQueries(suitePath);
|
||||||
|
|
||||||
|
const problemQueries =
|
||||||
|
await this.filterToOnlyProblemQueries(resolvedQueries);
|
||||||
|
|
||||||
|
if (problemQueries.length === 0) {
|
||||||
|
void this.app.logger.showErrorMessage(
|
||||||
|
`Unable to trigger variant analysis. No problem queries found in published query pack: ${packName}.`,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.runVariantAnalysis(
|
||||||
problemQueries.map((q) => Uri.file(q)),
|
problemQueries.map((q) => Uri.file(q)),
|
||||||
progress,
|
(p) =>
|
||||||
|
progress({
|
||||||
|
...p,
|
||||||
|
maxStep: p.maxStep + 3,
|
||||||
|
step: p.step + 3,
|
||||||
|
}),
|
||||||
token,
|
token,
|
||||||
),
|
);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async filterToOnlyProblemQueries(
|
private async filterToOnlyProblemQueries(
|
||||||
|
|||||||
Reference in New Issue
Block a user