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( export async function prepareRemoteQueryRun(
cliServer: CodeQLCliServer, cliServer: CodeQLCliServer,
credentials: Credentials, credentials: Credentials,
uri: Uri, uris: Uri[],
progress: ProgressCallback, progress: ProgressCallback,
token: CancellationToken, token: CancellationToken,
dbManager: DbManager, dbManager: DbManager,
): Promise<PreparedRemoteQuery> { ): 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")) { if (!uri.fsPath.endsWith(".ql")) {
throw new UserCancellationException("Not a CodeQL query file."); throw new UserCancellationException("Not a CodeQL query file.");
} }

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

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

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

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