Merge pull request #2084 from github/koesie10/remove-remote-queries
Remove remaining remote queries code
This commit is contained in:
@@ -10,7 +10,6 @@ import {
|
||||
languages,
|
||||
ProgressLocation,
|
||||
ProgressOptions,
|
||||
ProviderResult,
|
||||
QuickPickItem,
|
||||
Range,
|
||||
Uri,
|
||||
@@ -101,14 +100,13 @@ import {
|
||||
withProgress,
|
||||
} from "./commandRunner";
|
||||
import { CodeQlStatusBarHandler } from "./status-bar";
|
||||
import { URLSearchParams } from "url";
|
||||
import {
|
||||
handleDownloadPacks,
|
||||
handleInstallPackDependencies,
|
||||
} from "./packaging";
|
||||
import { HistoryItemLabelProvider } from "./query-history/history-item-label-provider";
|
||||
import {
|
||||
exportSelectedRemoteQueryResults,
|
||||
exportSelectedVariantAnalysisResults,
|
||||
exportVariantAnalysisResults,
|
||||
} from "./remote-queries/export-results";
|
||||
import { EvalLogViewer } from "./eval-log-viewer";
|
||||
@@ -1077,8 +1075,6 @@ async function activateWithInstalledDistribution(
|
||||
),
|
||||
);
|
||||
|
||||
registerRemoteQueryTextProvider();
|
||||
|
||||
// The "runVariantAnalysis" command is internal-only.
|
||||
ctx.subscriptions.push(
|
||||
commandRunnerWithProgress(
|
||||
@@ -1177,7 +1173,7 @@ async function activateWithInstalledDistribution(
|
||||
|
||||
ctx.subscriptions.push(
|
||||
commandRunner("codeQL.exportSelectedVariantAnalysisResults", async () => {
|
||||
await exportSelectedRemoteQueryResults(qhm);
|
||||
await exportSelectedVariantAnalysisResults(qhm);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -1613,21 +1609,6 @@ async function initializeLogging(ctx: ExtensionContext): Promise<void> {
|
||||
|
||||
const checkForUpdatesCommand = "codeQL.checkForUpdatesToCLI";
|
||||
|
||||
/**
|
||||
* This text provider lets us open readonly files in the editor.
|
||||
*
|
||||
* TODO: Consolidate this with the 'codeql' text provider in query-history-manager.ts.
|
||||
*/
|
||||
function registerRemoteQueryTextProvider() {
|
||||
workspace.registerTextDocumentContentProvider("remote-query", {
|
||||
provideTextDocumentContent(uri: Uri): ProviderResult<string> {
|
||||
const params = new URLSearchParams(uri.query);
|
||||
|
||||
return params.get("queryText");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const avoidVersionCheck = "avoid-version-check-at-startup";
|
||||
const lastVersionChecked = "last-version-checked";
|
||||
async function assertVSCodeVersionGreaterThan(
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import * as sarif from "sarif";
|
||||
import { AnalysisResults } from "../remote-queries/shared/analysis-result";
|
||||
import {
|
||||
AnalysisSummary,
|
||||
RemoteQueryResult,
|
||||
} from "../remote-queries/shared/remote-query-result";
|
||||
import {
|
||||
RawResultSet,
|
||||
ResultRow,
|
||||
@@ -58,13 +53,6 @@ export interface QueryMetadata {
|
||||
scored?: string;
|
||||
}
|
||||
|
||||
export interface PreviousExecution {
|
||||
queryName: string;
|
||||
time: string;
|
||||
databaseName: string;
|
||||
durationSeconds: number;
|
||||
}
|
||||
|
||||
export type SarifInterpretationData = {
|
||||
t: "SarifInterpretationData";
|
||||
/**
|
||||
@@ -222,11 +210,6 @@ export interface OpenFileMsg {
|
||||
filePath: string;
|
||||
}
|
||||
|
||||
export interface OpenVirtualFileMsg {
|
||||
t: "openVirtualFile";
|
||||
queryText: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Message from the results view to toggle the display of
|
||||
* query diagnostics.
|
||||
@@ -353,12 +336,6 @@ export interface SetComparisonsMessage {
|
||||
readonly databaseUri: string;
|
||||
}
|
||||
|
||||
export enum DiffKind {
|
||||
Add = "Add",
|
||||
Remove = "Remove",
|
||||
Change = "Change",
|
||||
}
|
||||
|
||||
/**
|
||||
* from is the set of rows that have changes in the "from" query.
|
||||
* to is the set of rows that have changes in the "to" query.
|
||||
@@ -407,56 +384,6 @@ export interface ParsedResultSets {
|
||||
resultSet: ResultSet;
|
||||
}
|
||||
|
||||
export type FromRemoteQueriesMessage =
|
||||
| ViewLoadedMsg
|
||||
| RemoteQueryErrorMessage
|
||||
| OpenFileMsg
|
||||
| OpenVirtualFileMsg
|
||||
| RemoteQueryDownloadAnalysisResultsMessage
|
||||
| RemoteQueryDownloadAllAnalysesResultsMessage
|
||||
| RemoteQueryExportResultsMessage
|
||||
| CopyRepoListMessage
|
||||
| TelemetryMessage;
|
||||
|
||||
export type ToRemoteQueriesMessage =
|
||||
| SetRemoteQueryResultMessage
|
||||
| SetAnalysesResultsMessage;
|
||||
|
||||
export interface SetRemoteQueryResultMessage {
|
||||
t: "setRemoteQueryResult";
|
||||
queryResult: RemoteQueryResult;
|
||||
}
|
||||
|
||||
export interface SetAnalysesResultsMessage {
|
||||
t: "setAnalysesResults";
|
||||
analysesResults: AnalysisResults[];
|
||||
}
|
||||
|
||||
export interface RemoteQueryErrorMessage {
|
||||
t: "remoteQueryError";
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface RemoteQueryDownloadAnalysisResultsMessage {
|
||||
t: "remoteQueryDownloadAnalysisResults";
|
||||
analysisSummary: AnalysisSummary;
|
||||
}
|
||||
|
||||
export interface RemoteQueryDownloadAllAnalysesResultsMessage {
|
||||
t: "remoteQueryDownloadAllAnalysesResults";
|
||||
analysisSummaries: AnalysisSummary[];
|
||||
}
|
||||
|
||||
export interface RemoteQueryExportResultsMessage {
|
||||
t: "remoteQueryExportResults";
|
||||
queryId: string;
|
||||
}
|
||||
|
||||
export interface CopyRepoListMessage {
|
||||
t: "copyRepoList";
|
||||
queryId: string;
|
||||
}
|
||||
|
||||
export interface SetVariantAnalysisMessage {
|
||||
t: "setVariantAnalysis";
|
||||
variantAnalysis: VariantAnalysis;
|
||||
|
||||
@@ -22,7 +22,7 @@ export function getRawQueryName(item: QueryHistoryInfo): string {
|
||||
|
||||
/**
|
||||
* Gets an identifier for the query history item which could be
|
||||
* a local/remote query or a variant analysis. This id isn't guaranteed
|
||||
* a local query or a variant analysis. This id isn't guaranteed
|
||||
* to be unique for each item in the query history.
|
||||
* @param item the history item.
|
||||
* @returns the id of the query or variant analysis.
|
||||
|
||||
@@ -755,14 +755,12 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
) {
|
||||
// show original query file on double click
|
||||
await this.handleOpenQuery(finalSingleItem, [finalSingleItem]);
|
||||
} else {
|
||||
} else if (
|
||||
finalSingleItem.t === "variant-analysis" ||
|
||||
finalSingleItem.status === QueryStatus.Completed
|
||||
) {
|
||||
// show results on single click (if results view is available)
|
||||
if (
|
||||
finalSingleItem.t === "variant-analysis" ||
|
||||
finalSingleItem.status === QueryStatus.Completed
|
||||
) {
|
||||
await this.openQueryResults(finalSingleItem);
|
||||
}
|
||||
await this.openQueryResults(finalSingleItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,6 +795,8 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
return this.variantAnalysisManager.getVariantAnalysisStorageLocation(
|
||||
queryHistoryItem.variantAnalysis.id,
|
||||
);
|
||||
} else {
|
||||
assertNever(queryHistoryItem);
|
||||
}
|
||||
|
||||
throw new Error("Unable to get query directory");
|
||||
@@ -830,6 +830,8 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
),
|
||||
"timestamp",
|
||||
);
|
||||
} else {
|
||||
assertNever(finalSingleItem);
|
||||
}
|
||||
|
||||
if (externalFilePath) {
|
||||
@@ -994,6 +996,8 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
"codeQL.cancelVariantAnalysis",
|
||||
item.variantAnalysis.id,
|
||||
);
|
||||
} else {
|
||||
assertNever(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1185,17 +1189,19 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
multiSelect,
|
||||
);
|
||||
|
||||
// Remote queries only
|
||||
if (!this.assertSingleQuery(finalMultiSelect) || !finalSingleItem) {
|
||||
// Variant analyses only
|
||||
if (
|
||||
!this.assertSingleQuery(finalMultiSelect) ||
|
||||
!finalSingleItem ||
|
||||
finalSingleItem.t !== "variant-analysis"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (finalSingleItem.t === "variant-analysis") {
|
||||
await commands.executeCommand(
|
||||
"codeQL.copyVariantAnalysisRepoList",
|
||||
finalSingleItem.variantAnalysis.id,
|
||||
);
|
||||
}
|
||||
await commands.executeCommand(
|
||||
"codeQL.copyVariantAnalysisRepoList",
|
||||
finalSingleItem.variantAnalysis.id,
|
||||
);
|
||||
}
|
||||
|
||||
async handleExportResults(
|
||||
@@ -1207,17 +1213,19 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
multiSelect,
|
||||
);
|
||||
|
||||
if (!this.assertSingleQuery(finalMultiSelect) || !finalSingleItem) {
|
||||
// Variant analysis only
|
||||
if (
|
||||
!this.assertSingleQuery(finalMultiSelect) ||
|
||||
!finalSingleItem ||
|
||||
finalSingleItem.t !== "variant-analysis"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Variant analysis only
|
||||
if (finalSingleItem.t === "variant-analysis") {
|
||||
await commands.executeCommand(
|
||||
"codeQL.exportVariantAnalysisResults",
|
||||
finalSingleItem.variantAnalysis.id,
|
||||
);
|
||||
}
|
||||
await commands.executeCommand(
|
||||
"codeQL.exportVariantAnalysisResults",
|
||||
finalSingleItem.variantAnalysis.id,
|
||||
);
|
||||
}
|
||||
|
||||
addQuery(item: QueryHistoryInfo) {
|
||||
@@ -1290,7 +1298,7 @@ the file in the file explorer and dragging it into the workspace.`,
|
||||
singleItem: QueryHistoryInfo,
|
||||
multiSelect: QueryHistoryInfo[],
|
||||
): Promise<CompletedLocalQueryInfo | undefined> {
|
||||
// Remote queries cannot be compared
|
||||
// Variant analyses cannot be compared
|
||||
if (
|
||||
singleItem.t !== "local" ||
|
||||
multiSelect.some((s) => s.t !== "local") ||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
import { join } from "path";
|
||||
|
||||
/**
|
||||
* Represents a link to an artifact to be downloaded.
|
||||
*/
|
||||
export interface DownloadLink {
|
||||
/**
|
||||
* A unique id of the artifact being downloaded.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The URL path to use against the GitHub API to download the
|
||||
* linked artifact.
|
||||
*/
|
||||
urlPath: string;
|
||||
|
||||
/**
|
||||
* An optional path to follow inside the downloaded archive containing the artifact.
|
||||
*/
|
||||
innerFilePath?: string;
|
||||
|
||||
/**
|
||||
* A unique id of the remote query run. This is used to determine where to store artifacts and data from the run.
|
||||
*/
|
||||
queryId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a downloadLink to the path where the artifact should be stored.
|
||||
*
|
||||
* @param storagePath The base directory to store artifacts in.
|
||||
* @param downloadLink The DownloadLink
|
||||
* @param extension An optional file extension to append to the artifact (no `.`).
|
||||
*
|
||||
* @returns A full path to the download location of the artifact
|
||||
*/
|
||||
export function createDownloadPath(
|
||||
storagePath: string,
|
||||
downloadLink: DownloadLink,
|
||||
extension = "",
|
||||
) {
|
||||
return join(
|
||||
storagePath,
|
||||
downloadLink.queryId,
|
||||
downloadLink.id + (extension ? `.${extension}` : ""),
|
||||
);
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
} from "./markdown-generation";
|
||||
import { pluralize } from "../pure/word";
|
||||
import { VariantAnalysisManager } from "./variant-analysis-manager";
|
||||
import { assertNever } from "../pure/helpers-pure";
|
||||
import {
|
||||
VariantAnalysis,
|
||||
VariantAnalysisScannedRepository,
|
||||
@@ -35,32 +34,28 @@ import {
|
||||
import { Credentials } from "../common/authentication";
|
||||
|
||||
/**
|
||||
* Exports the results of the currently-selected remote query or variant analysis.
|
||||
* Exports the results of the currently-selected variant analysis.
|
||||
*/
|
||||
export async function exportSelectedRemoteQueryResults(
|
||||
export async function exportSelectedVariantAnalysisResults(
|
||||
queryHistoryManager: QueryHistoryManager,
|
||||
): Promise<void> {
|
||||
const queryHistoryItem = queryHistoryManager.getCurrentQueryHistoryItem();
|
||||
if (!queryHistoryItem || queryHistoryItem.t === "local") {
|
||||
if (!queryHistoryItem || queryHistoryItem.t !== "variant-analysis") {
|
||||
throw new Error(
|
||||
"No variant analysis results currently open. To open results, click an item in the query history view.",
|
||||
);
|
||||
}
|
||||
|
||||
if (queryHistoryItem.t === "variant-analysis") {
|
||||
return commands.executeCommand(
|
||||
"codeQL.exportVariantAnalysisResults",
|
||||
queryHistoryItem.variantAnalysis.id,
|
||||
);
|
||||
} else {
|
||||
assertNever(queryHistoryItem);
|
||||
}
|
||||
return commands.executeCommand(
|
||||
"codeQL.exportVariantAnalysisResults",
|
||||
queryHistoryItem.variantAnalysis.id,
|
||||
);
|
||||
}
|
||||
|
||||
const MAX_VARIANT_ANALYSIS_EXPORT_PROGRESS_STEPS = 2;
|
||||
|
||||
/**
|
||||
* Exports the results of the given or currently-selected remote query.
|
||||
* Exports the results of the given or currently-selected variant analysis.
|
||||
* The user is prompted to select the export format.
|
||||
*/
|
||||
export async function exportVariantAnalysisResults(
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export interface Repository {
|
||||
owner: string;
|
||||
name: string;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
export interface AnalysisFailure {
|
||||
nwo: string;
|
||||
error: string;
|
||||
}
|
||||
@@ -1,17 +1,5 @@
|
||||
import { RawResultSet, ResultSetSchema } from "../../pure/bqrs-cli-types";
|
||||
|
||||
export type AnalysisResultStatus = "InProgress" | "Completed" | "Failed";
|
||||
|
||||
export interface AnalysisResults {
|
||||
nwo: string;
|
||||
status: AnalysisResultStatus;
|
||||
interpretedResults: AnalysisAlert[];
|
||||
rawResults?: AnalysisRawResults;
|
||||
resultCount: number;
|
||||
starCount?: number;
|
||||
lastUpdated?: number;
|
||||
}
|
||||
|
||||
export interface AnalysisRawResults {
|
||||
schema: ResultSetSchema;
|
||||
resultSet: RawResultSet;
|
||||
@@ -82,19 +70,3 @@ export interface AnalysisMessageLocationToken {
|
||||
}
|
||||
|
||||
export type ResultSeverity = "Recommendation" | "Warning" | "Error";
|
||||
|
||||
/**
|
||||
* Returns the number of (raw + interpreted) results for an analysis.
|
||||
*/
|
||||
export const getAnalysisResultCount = (
|
||||
analysisResults: AnalysisResults,
|
||||
): number => {
|
||||
const rawResultCount = analysisResults.rawResults?.resultSet.rows.length || 0;
|
||||
return analysisResults.interpretedResults.length + rawResultCount;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the total number of results for an analysis by adding all individual repo results.
|
||||
*/
|
||||
export const sumAnalysesResults = (analysesResults: AnalysisResults[]) =>
|
||||
analysesResults.reduce((acc, curr) => acc + getAnalysisResultCount(curr), 0);
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import { DownloadLink } from "../download-link";
|
||||
import { AnalysisFailure } from "./analysis-failure";
|
||||
|
||||
export interface RemoteQueryResult {
|
||||
queryId: string;
|
||||
queryTitle: string;
|
||||
queryFileName: string;
|
||||
queryFilePath: string;
|
||||
queryText: string;
|
||||
language: string;
|
||||
workflowRunUrl: string;
|
||||
totalRepositoryCount: number;
|
||||
affectedRepositoryCount: number;
|
||||
totalResultCount: number;
|
||||
executionTimestamp: string;
|
||||
executionDuration: string;
|
||||
analysisSummaries: AnalysisSummary[];
|
||||
analysisFailures: AnalysisFailure[];
|
||||
}
|
||||
|
||||
export interface AnalysisSummary {
|
||||
nwo: string;
|
||||
databaseSha: string;
|
||||
resultCount: number;
|
||||
sourceLocationPrefix: string;
|
||||
downloadLink: DownloadLink;
|
||||
fileSize: string;
|
||||
starCount?: number;
|
||||
lastUpdated?: number;
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
{
|
||||
"t": "setRemoteQueryResult",
|
||||
"queryResult": {
|
||||
"queryId": "Empty block-LUzMYbSaBM4Lv6YP8GQ8j",
|
||||
"queryTitle": "Empty block",
|
||||
"queryFileName": "example.ql",
|
||||
"queryFilePath": "/home/octocat/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql",
|
||||
"queryText": "/**\n * @name Empty block\n * @kind problem\n * @problem.severity warning\n * @id javascript/example/empty-block\n */\n\nimport javascript\n\nfrom BlockStmt b\nwhere b.getNumStmt() = 0\nselect b, \"This is an empty block.\"\n",
|
||||
"language": "javascript",
|
||||
"workflowRunUrl": "https://github.com/octocat/octo-repo/actions/runs/2955404400",
|
||||
"totalRepositoryCount": 10,
|
||||
"affectedRepositoryCount": 10,
|
||||
"totalResultCount": 16338,
|
||||
"executionTimestamp": "30 Aug at 0:14 pm",
|
||||
"executionDuration": "1 minute",
|
||||
"analysisSummaries": [
|
||||
{
|
||||
"nwo": "angular/angular",
|
||||
"databaseSha": "a360309f31afa97c4268a94fbd6a5108362a7182",
|
||||
"resultCount": 8436,
|
||||
"downloadLink": {
|
||||
"id": "346232925",
|
||||
"urlPath": "/repos/octocat/octo-repo/actions/artifacts/346232925",
|
||||
"innerFilePath": "results.sarif",
|
||||
"queryId": "Empty block-LUzMYbSaBM4Lv6YP8GQ8j"
|
||||
},
|
||||
"sourceLocationPrefix": "/home/runner/work/bulk-builder/bulk-builder",
|
||||
"fileSize": "5.67 MB",
|
||||
"starCount": 83537,
|
||||
"lastUpdated": -1066284
|
||||
},
|
||||
{
|
||||
"nwo": "babel/babel",
|
||||
"databaseSha": "0f62c58c79830cfe0afb26161e96e0e1b0482c01",
|
||||
"resultCount": 5502,
|
||||
"downloadLink": {
|
||||
"id": "346232926",
|
||||
"urlPath": "/repos/octocat/octo-repo/actions/artifacts/346232926",
|
||||
"innerFilePath": "results.sarif",
|
||||
"queryId": "Empty block-LUzMYbSaBM4Lv6YP8GQ8j"
|
||||
},
|
||||
"sourceLocationPrefix": "/home/runner/work/bulk-builder/bulk-builder",
|
||||
"fileSize": "3.80 MB",
|
||||
"starCount": 41292,
|
||||
"lastUpdated": -1600284
|
||||
},
|
||||
{
|
||||
"nwo": "facebook/react",
|
||||
"databaseSha": "e25648b0a89eab6f82bea2c2a1ef90866ac82b33",
|
||||
"resultCount": 1205,
|
||||
"downloadLink": {
|
||||
"id": "346232919",
|
||||
"urlPath": "/repos/octocat/octo-repo/actions/artifacts/346232919",
|
||||
"innerFilePath": "results.sarif",
|
||||
"queryId": "Empty block-LUzMYbSaBM4Lv6YP8GQ8j"
|
||||
},
|
||||
"sourceLocationPrefix": "/home/runner/work/bulk-builder/bulk-builder",
|
||||
"fileSize": "905.24 KB",
|
||||
"starCount": 194007,
|
||||
"lastUpdated": -379284
|
||||
},
|
||||
{
|
||||
"nwo": "facebook/jest",
|
||||
"databaseSha": "187566a70aa4b6aa5f74952b504bbeddb5854aef",
|
||||
"resultCount": 643,
|
||||
"downloadLink": {
|
||||
"id": "346232921",
|
||||
"urlPath": "/repos/octocat/octo-repo/actions/artifacts/346232921",
|
||||
"innerFilePath": "results.sarif",
|
||||
"queryId": "Empty block-LUzMYbSaBM4Lv6YP8GQ8j"
|
||||
},
|
||||
"sourceLocationPrefix": "/home/runner/work/bulk-builder/bulk-builder",
|
||||
"fileSize": "441.60 KB",
|
||||
"starCount": 39987,
|
||||
"lastUpdated": -113284
|
||||
},
|
||||
{
|
||||
"nwo": "facebook/create-react-app",
|
||||
"databaseSha": "f34d88e30c7d8be7181f728d1abc4fd8d5cd07d3",
|
||||
"resultCount": 198,
|
||||
"downloadLink": {
|
||||
"id": "346232928",
|
||||
"urlPath": "/repos/octocat/octo-repo/actions/artifacts/346232928",
|
||||
"innerFilePath": "results.sarif",
|
||||
"queryId": "Empty block-LUzMYbSaBM4Lv6YP8GQ8j"
|
||||
},
|
||||
"sourceLocationPrefix": "/home/runner/work/bulk-builder/bulk-builder",
|
||||
"fileSize": "132.28 KB",
|
||||
"starCount": 96698,
|
||||
"lastUpdated": -126284
|
||||
},
|
||||
{
|
||||
"nwo": "vuejs/vue",
|
||||
"databaseSha": "810f6d12edea47cde7f39eaf7ec3ae1b7300d40c",
|
||||
"resultCount": 140,
|
||||
"downloadLink": {
|
||||
"id": "346232920",
|
||||
"urlPath": "/repos/octocat/octo-repo/actions/artifacts/346232920",
|
||||
"innerFilePath": "results.sarif",
|
||||
"queryId": "Empty block-LUzMYbSaBM4Lv6YP8GQ8j"
|
||||
},
|
||||
"sourceLocationPrefix": "/home/runner/work/bulk-builder/bulk-builder",
|
||||
"fileSize": "89.99 KB",
|
||||
"starCount": 198970,
|
||||
"lastUpdated": -167284
|
||||
},
|
||||
{
|
||||
"nwo": "lodash/lodash",
|
||||
"databaseSha": "2da024c3b4f9947a48517639de7560457cd4ec6c",
|
||||
"resultCount": 108,
|
||||
"downloadLink": {
|
||||
"id": "346232927",
|
||||
"urlPath": "/repos/octocat/octo-repo/actions/artifacts/346232927",
|
||||
"innerFilePath": "results.sarif",
|
||||
"queryId": "Empty block-LUzMYbSaBM4Lv6YP8GQ8j"
|
||||
},
|
||||
"sourceLocationPrefix": "/home/runner/work/bulk-builder/bulk-builder",
|
||||
"fileSize": "70.43 KB",
|
||||
"starCount": 54215,
|
||||
"lastUpdated": -9080284
|
||||
},
|
||||
{
|
||||
"nwo": "jquery/jquery",
|
||||
"databaseSha": "d2436df36a4b2ef556907e734a90771f0dbdbcaf",
|
||||
"resultCount": 67,
|
||||
"downloadLink": {
|
||||
"id": "346232922",
|
||||
"urlPath": "/repos/octocat/octo-repo/actions/artifacts/346232922",
|
||||
"innerFilePath": "results.sarif",
|
||||
"queryId": "Empty block-LUzMYbSaBM4Lv6YP8GQ8j"
|
||||
},
|
||||
"sourceLocationPrefix": "/home/runner/work/jquery/jquery",
|
||||
"fileSize": "45.07 KB",
|
||||
"starCount": 56629,
|
||||
"lastUpdated": -23284
|
||||
},
|
||||
{
|
||||
"nwo": "expressjs/express",
|
||||
"databaseSha": "33e8dc303af9277f8a7e4f46abfdcb5e72f6797b",
|
||||
"resultCount": 26,
|
||||
"downloadLink": {
|
||||
"id": "346232924",
|
||||
"urlPath": "/repos/octocat/octo-repo/actions/artifacts/346232924",
|
||||
"innerFilePath": "results.sarif",
|
||||
"queryId": "Empty block-LUzMYbSaBM4Lv6YP8GQ8j"
|
||||
},
|
||||
"sourceLocationPrefix": "/home/runner/work/bulk-builder/bulk-builder",
|
||||
"fileSize": "16.96 KB",
|
||||
"starCount": 58125,
|
||||
"lastUpdated": -236284
|
||||
},
|
||||
{
|
||||
"nwo": "twbs/bootstrap",
|
||||
"databaseSha": "af1bd974bba7f6e7f90c5ed3f42738bd101926cb",
|
||||
"resultCount": 13,
|
||||
"downloadLink": {
|
||||
"id": "346232923",
|
||||
"urlPath": "/repos/octocat/octo-repo/actions/artifacts/346232923",
|
||||
"innerFilePath": "results.sarif",
|
||||
"queryId": "Empty block-LUzMYbSaBM4Lv6YP8GQ8j"
|
||||
},
|
||||
"sourceLocationPrefix": "/home/runner/work/bootstrap/bootstrap",
|
||||
"fileSize": "8.50 KB",
|
||||
"starCount": 159230,
|
||||
"lastUpdated": -1754284
|
||||
}
|
||||
],
|
||||
"analysisFailures": []
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
FromCompareViewMessage,
|
||||
FromRemoteQueriesMessage,
|
||||
FromResultsViewMsg,
|
||||
FromVariantAnalysisMessage,
|
||||
VariantAnalysisState,
|
||||
@@ -14,7 +13,6 @@ export interface VsCodeApi {
|
||||
msg:
|
||||
| FromResultsViewMsg
|
||||
| FromCompareViewMessage
|
||||
| FromRemoteQueriesMessage
|
||||
| FromVariantAnalysisMessage,
|
||||
): void;
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
import { join } from "path";
|
||||
|
||||
import {
|
||||
DownloadLink,
|
||||
createDownloadPath,
|
||||
} from "../../../src/remote-queries/download-link";
|
||||
|
||||
describe("createDownloadPath", () => {
|
||||
it("should return the correct path", () => {
|
||||
const downloadLink: DownloadLink = {
|
||||
id: "abc",
|
||||
urlPath: "",
|
||||
innerFilePath: "",
|
||||
queryId: "def",
|
||||
};
|
||||
const expectedPath = join("storage", "def", "abc");
|
||||
|
||||
const actualPath = createDownloadPath("storage", downloadLink);
|
||||
|
||||
expect(actualPath).toBe(expectedPath);
|
||||
});
|
||||
|
||||
it("should return the correct path with extension", () => {
|
||||
const downloadLink: DownloadLink = {
|
||||
id: "abc",
|
||||
urlPath: "",
|
||||
innerFilePath: "",
|
||||
queryId: "def",
|
||||
};
|
||||
|
||||
const expectedPath = join("storage", "def", "abc.zip");
|
||||
|
||||
const actualPath = createDownloadPath("storage", downloadLink, "zip");
|
||||
|
||||
expect(actualPath).toBe(expectedPath);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user