@@ -2,8 +2,8 @@ import { join } from "path";
22import { ensureDir , writeFile } from "fs-extra" ;
33
44import {
5- commands ,
65 CancellationToken ,
6+ commands ,
77 Uri ,
88 ViewColumn ,
99 window ,
@@ -14,15 +14,11 @@ import { showInformationMessageWithAction } from "../helpers";
1414import { extLogger } from "../common" ;
1515import { QueryHistoryManager } from "../query-history/query-history-manager" ;
1616import { createGist } from "./gh-api/gh-api-client" ;
17- import { RemoteQueriesManager } from "./remote-queries-manager" ;
1817import {
19- generateMarkdown ,
2018 generateVariantAnalysisMarkdown ,
2119 MarkdownFile ,
2220 RepositorySummary ,
2321} from "./remote-queries-markdown-generation" ;
24- import { RemoteQuery } from "./remote-query" ;
25- import { AnalysisResults , sumAnalysesResults } from "./shared/analysis-result" ;
2622import { pluralize } from "../pure/word" ;
2723import { VariantAnalysisManager } from "./variant-analysis-manager" ;
2824import { assertNever } from "../pure/helpers-pure" ;
@@ -52,10 +48,7 @@ export async function exportSelectedRemoteQueryResults(
5248 }
5349
5450 if ( queryHistoryItem . t === "remote" ) {
55- return commands . executeCommand (
56- "codeQL.exportRemoteQueryResults" ,
57- queryHistoryItem . queryId ,
58- ) ;
51+ // Do nothing. TODO: Remove this branch once we stop supporting remote queries.
5952 } else if ( queryHistoryItem . t === "variant-analysis" ) {
6053 return commands . executeCommand (
6154 "codeQL.exportVariantAnalysisResults" ,
@@ -66,73 +59,6 @@ export async function exportSelectedRemoteQueryResults(
6659 }
6760}
6861
69- /**
70- * Exports the results of the given remote query.
71- * The user is prompted to select the export format.
72- */
73- export async function exportRemoteQueryResults (
74- queryHistoryManager : QueryHistoryManager ,
75- remoteQueriesManager : RemoteQueriesManager ,
76- queryId : string ,
77- credentials : Credentials ,
78- ) : Promise < void > {
79- const queryHistoryItem = queryHistoryManager . getRemoteQueryById ( queryId ) ;
80- if ( ! queryHistoryItem ) {
81- void extLogger . log ( `Could not find query with id ${ queryId } ` ) ;
82- throw new Error (
83- "There was an error when trying to retrieve variant analysis information" ,
84- ) ;
85- }
86-
87- if ( ! queryHistoryItem . completed ) {
88- throw new Error ( "Variant analysis results are not yet available." ) ;
89- }
90-
91- void extLogger . log (
92- `Exporting variant analysis results for query: ${ queryHistoryItem . queryId } ` ,
93- ) ;
94- const query = queryHistoryItem . remoteQuery ;
95- const analysesResults = remoteQueriesManager . getAnalysesResults (
96- queryHistoryItem . queryId ,
97- ) ;
98-
99- const exportFormat = await determineExportFormat ( ) ;
100- if ( ! exportFormat ) {
101- return ;
102- }
103-
104- const exportDirectory =
105- await queryHistoryManager . getQueryHistoryItemDirectory ( queryHistoryItem ) ;
106- const exportedResultsDirectory = join ( exportDirectory , "exported-results" ) ;
107-
108- await exportRemoteQueryAnalysisResults (
109- exportedResultsDirectory ,
110- query ,
111- analysesResults ,
112- exportFormat ,
113- credentials ,
114- ) ;
115- }
116-
117- export async function exportRemoteQueryAnalysisResults (
118- exportedResultsPath : string ,
119- query : RemoteQuery ,
120- analysesResults : AnalysisResults [ ] ,
121- exportFormat : "gist" | "local" ,
122- credentials : Credentials ,
123- ) {
124- const description = buildGistDescription ( query , analysesResults ) ;
125- const markdownFiles = generateMarkdown ( query , analysesResults , exportFormat ) ;
126-
127- await exportResults (
128- exportedResultsPath ,
129- description ,
130- markdownFiles ,
131- exportFormat ,
132- credentials ,
133- ) ;
134- }
135-
13662const MAX_VARIANT_ANALYSIS_EXPORT_PROGRESS_STEPS = 2 ;
13763
13864/**
@@ -396,22 +322,6 @@ export async function exportToGist(
396322 }
397323}
398324
399- /**
400- * Builds Gist description
401- * Ex: Empty Block (Go) x results (y repositories)
402- */
403- const buildGistDescription = (
404- query : RemoteQuery ,
405- analysesResults : AnalysisResults [ ] ,
406- ) => {
407- const resultCount = sumAnalysesResults ( analysesResults ) ;
408- const resultLabel = pluralize ( resultCount , "result" , "results" ) ;
409- const repositoryLabel = query . repositoryCount
410- ? `(${ pluralize ( query . repositoryCount , "repository" , "repositories" ) } )`
411- : "" ;
412- return `${ query . queryName } (${ query . language } ) ${ resultLabel } ${ repositoryLabel } ` ;
413- } ;
414-
415325/**
416326 * Builds Gist description
417327 * Ex: Empty Block (Go) x results (y repositories)
0 commit comments