Remove codeQL.copyRepoList command

This commit is contained in:
Koen Vlaswinkel
2023-02-13 14:31:50 +01:00
parent dcdb303da7
commit 255f1b6a5d
5 changed files with 2 additions and 62 deletions

View File

@@ -1128,12 +1128,6 @@ async function activateWithInstalledDistribution(
),
);
ctx.subscriptions.push(
commandRunner("codeQL.copyRepoList", async (queryId: string) => {
await rqm.copyRemoteQueryRepoListToClipboard(queryId);
}),
);
ctx.subscriptions.push(
commandRunner(
"codeQL.openVariantAnalysisLogs",

View File

@@ -1289,12 +1289,7 @@ export class QueryHistoryManager extends DisposableObject {
return;
}
if (finalSingleItem.t === "remote") {
await commands.executeCommand(
"codeQL.copyRepoList",
finalSingleItem.queryId,
);
} else if (finalSingleItem.t === "variant-analysis") {
if (finalSingleItem.t === "variant-analysis") {
await commands.executeCommand(
"codeQL.copyVariantAnalysisRepoList",
finalSingleItem.variantAnalysis.id,

View File

@@ -1,7 +1,6 @@
import { CancellationToken, env, EventEmitter, ExtensionContext } from "vscode";
import { CancellationToken, EventEmitter, ExtensionContext } from "vscode";
import { join } from "path";
import { pathExists, readFile, remove } from "fs-extra";
import { EOL } from "os";
import { CodeQLCliServer } from "../cli";
import { showAndLogExceptionWithTelemetry } from "../helpers";
@@ -152,37 +151,10 @@ export class RemoteQueriesManager extends DisposableObject {
);
}
public async copyRemoteQueryRepoListToClipboard(queryId: string) {
const queryResult = await this.getRemoteQueryResult(queryId);
const repos = queryResult.analysisSummaries
.filter((a) => a.resultCount > 0)
.map((a) => a.nwo);
if (repos.length > 0) {
const text = [
'"new-repo-list": [',
...repos.slice(0, -1).map((repo) => ` "${repo}",`),
` "${repos[repos.length - 1]}"`,
"]",
];
await env.clipboard.writeText(text.join(EOL));
}
}
public async openResults(query: RemoteQuery, queryResult: RemoteQueryResult) {
await this.view.showResults(query, queryResult);
}
private async getRemoteQueryResult(
queryId: string,
): Promise<RemoteQueryResult> {
return await this.retrieveJsonFile<RemoteQueryResult>(
queryId,
"query-result.json",
);
}
private async retrieveJsonFile<T>(
queryId: string,
fileName: string,

View File

@@ -154,7 +154,6 @@ export class RemoteQueriesView extends AbstractWebview<
await this.openVirtualFile(msg.queryText);
break;
case "copyRepoList":
await commands.executeCommand("codeQL.copyRepoList", msg.queryId);
break;
case "remoteQueryDownloadAnalysisResults":
await this.downloadAnalysisResults(msg);

View File

@@ -1109,26 +1109,6 @@ describe("QueryHistoryManager", () => {
expect(executeCommandSpy).not.toBeCalled();
});
it("should copy repo list for a single remote query", async () => {
queryHistoryManager = await createMockQueryHistory(allHistory);
const item = remoteQueryHistory[1];
await queryHistoryManager.handleCopyRepoList(item, [item]);
expect(executeCommandSpy).toBeCalledWith(
"codeQL.copyRepoList",
item.queryId,
);
});
it("should not copy repo list for multiple remote queries", async () => {
queryHistoryManager = await createMockQueryHistory(allHistory);
const item1 = remoteQueryHistory[1];
const item2 = remoteQueryHistory[3];
await queryHistoryManager.handleCopyRepoList(item1, [item1, item2]);
expect(executeCommandSpy).not.toBeCalled();
});
it("should copy repo list for a single variant analysis", async () => {
queryHistoryManager = await createMockQueryHistory(allHistory);