Allow multiple file URIs to be passed into prepareRemoteQueryRun (#3241)

This commit is contained in:
Charis Kyriakou 2024-01-16 15:05:24 +00:00 коммит произвёл GitHub
Родитель f993258a27
Коммит 318136f5e5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 17 добавлений и 9 удалений

Просмотреть файл

@ -274,11 +274,19 @@ interface PreparedRemoteQuery {
export async function prepareRemoteQueryRun(
cliServer: CodeQLCliServer,
credentials: Credentials,
uri: Uri,
uris: Uri[],
progress: ProgressCallback,
token: CancellationToken,
dbManager: DbManager,
): Promise<PreparedRemoteQuery> {
if (uris.length !== 1) {
// For now we only support a single file, but we're aiming
// to support multiple files in the near future.
throw Error("Exactly one query file must be selected.");
}
const uri = uris[0];
if (!uri.fsPath.endsWith(".ql")) {
throw new UserCancellationException("Not a CodeQL query file.");
}

Просмотреть файл

@ -220,7 +220,7 @@ export class VariantAnalysisManager
private async runVariantAnalysisCommand(uri: Uri): Promise<void> {
return withProgress(
async (progress, token) => {
await this.runVariantAnalysis(uri, progress, token);
await this.runVariantAnalysis([uri], progress, token);
},
{
title: "Run Variant Analysis",
@ -230,7 +230,7 @@ export class VariantAnalysisManager
}
public async runVariantAnalysis(
uri: Uri,
uris: Uri[],
progress: ProgressCallback,
token: CancellationToken,
): Promise<void> {
@ -254,7 +254,7 @@ export class VariantAnalysisManager
} = await prepareRemoteQueryRun(
this.cliServer,
this.app.credentials,
uri,
uris,
progress,
token,
this.dbManager,

Просмотреть файл

@ -100,7 +100,7 @@ describe("Variant Analysis Manager", () => {
const fileUri = getFile("data-remote-qlpack/in-pack.ql");
await variantAnalysisManager.runVariantAnalysis(
fileUri,
[fileUri],
progress,
cancellationTokenSource.token,
);
@ -121,7 +121,7 @@ describe("Variant Analysis Manager", () => {
const fileUri = getFile("data-remote-no-qlpack/in-pack.ql");
await variantAnalysisManager.runVariantAnalysis(
fileUri,
[fileUri],
progress,
cancellationTokenSource.token,
);
@ -142,7 +142,7 @@ describe("Variant Analysis Manager", () => {
const fileUri = getFile("data-remote-qlpack-nested/subfolder/in-pack.ql");
await variantAnalysisManager.runVariantAnalysis(
fileUri,
[fileUri],
progress,
cancellationTokenSource.token,
);
@ -163,7 +163,7 @@ describe("Variant Analysis Manager", () => {
const fileUri = getFile("data-remote-no-qlpack/in-pack.ql");
const promise = variantAnalysisManager.runVariantAnalysis(
fileUri,
[fileUri],
progress,
cancellationTokenSource.token,
);
@ -313,7 +313,7 @@ describe("Variant Analysis Manager", () => {
}) {
const fileUri = getFile(queryPath);
await variantAnalysisManager.runVariantAnalysis(
fileUri,
[fileUri],
progress,
cancellationTokenSource.token,
);