Skip to content

Commit 91a96da

Browse files
Start progress bar earlier
1 parent 9dc37eb commit 91a96da

File tree

1 file changed

+50
-27
lines changed

1 file changed

+50
-27
lines changed

extensions/ql-vscode/src/variant-analysis/variant-analysis-manager.ts

Lines changed: 50 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -215,42 +215,65 @@ export class VariantAnalysisManager
215215
}
216216

217217
private async runVariantAnalysisFromPublishedPack(): Promise<void> {
218-
const language = await askForLanguage(this.cliServer);
218+
return withProgress(async (progress, token) => {
219+
progress({
220+
maxStep: 8,
221+
step: 0,
222+
message: "Determining query language",
223+
});
219224

220-
const packName = `codeql/${language}-queries`;
221-
const packDownloadResult = await this.cliServer.packDownload([packName]);
222-
const downloadedPack = packDownloadResult.packs[0];
225+
const language = await askForLanguage(this.cliServer);
223226

224-
const packDir = join(
225-
packDownloadResult.packDir,
226-
downloadedPack.name,
227-
downloadedPack.version,
228-
);
227+
progress({
228+
maxStep: 8,
229+
step: 1,
230+
message: "Downloading query pack",
231+
});
229232

230-
const suitePath = join(
231-
packDir,
232-
"codeql-suites",
233-
`${language}-code-scanning.qls`,
234-
);
235-
const resolvedQueries = await this.cliServer.resolveQueries(suitePath);
233+
const packName = `codeql/${language}-queries`;
234+
const packDownloadResult = await this.cliServer.packDownload([packName]);
235+
const downloadedPack = packDownloadResult.packs[0];
236236

237-
const problemQueries =
238-
await this.filterToOnlyProblemQueries(resolvedQueries);
237+
const packDir = join(
238+
packDownloadResult.packDir,
239+
downloadedPack.name,
240+
downloadedPack.version,
241+
);
239242

240-
if (problemQueries.length === 0) {
241-
void this.app.logger.showErrorMessage(
242-
`Unable to trigger variant analysis. No problem queries found in published query pack: ${packName}.`,
243+
progress({
244+
maxStep: 8,
245+
step: 2,
246+
message: "Resolving queries in pack",
247+
});
248+
249+
const suitePath = join(
250+
packDir,
251+
"codeql-suites",
252+
`${language}-code-scanning.qls`,
243253
);
244-
return;
245-
}
254+
const resolvedQueries = await this.cliServer.resolveQueries(suitePath);
246255

247-
return withProgress((progress, token) =>
248-
this.runVariantAnalysis(
256+
const problemQueries =
257+
await this.filterToOnlyProblemQueries(resolvedQueries);
258+
259+
if (problemQueries.length === 0) {
260+
void this.app.logger.showErrorMessage(
261+
`Unable to trigger variant analysis. No problem queries found in published query pack: ${packName}.`,
262+
);
263+
return;
264+
}
265+
266+
await this.runVariantAnalysis(
249267
problemQueries.map((q) => Uri.file(q)),
250-
progress,
268+
(p) =>
269+
progress({
270+
...p,
271+
maxStep: p.maxStep + 3,
272+
step: p.step + 3,
273+
}),
251274
token,
252-
),
253-
);
275+
);
276+
});
254277
}
255278

256279
private async filterToOnlyProblemQueries(

0 commit comments

Comments
 (0)