Skip to content

Commit 517feec

Browse files
authored
Remove SARIF viewer support (#1213)
1 parent 9436a49 commit 517feec

4 files changed

Lines changed: 7 additions & 60 deletions

File tree

extensions/ql-vscode/src/pure/interface-types.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,7 @@ export type FromRemoteQueriesMessage =
394394
| OpenFileMsg
395395
| OpenVirtualFileMsg
396396
| RemoteQueryDownloadAnalysisResultsMessage
397-
| RemoteQueryDownloadAllAnalysesResultsMessage
398-
| RemoteQueryViewAnalysisResultsMessage;
397+
| RemoteQueryDownloadAllAnalysesResultsMessage;
399398

400399
export type ToRemoteQueriesMessage =
401400
| SetRemoteQueryResultMessage
@@ -430,7 +429,3 @@ export interface RemoteQueryDownloadAllAnalysesResultsMessage {
430429
analysisSummaries: AnalysisSummary[];
431430
}
432431

433-
export interface RemoteQueryViewAnalysisResultsMessage {
434-
t: 'remoteQueryViewAnalysisResults';
435-
analysisSummary: AnalysisSummary
436-
}

extensions/ql-vscode/src/remote-queries/remote-queries-interface.ts

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@ import {
44
window as Window,
55
ViewColumn,
66
Uri,
7-
workspace,
8-
extensions,
9-
commands,
7+
workspace
108
} from 'vscode';
119
import * as path from 'path';
1210

1311
import {
1412
ToRemoteQueriesMessage,
1513
FromRemoteQueriesMessage,
1614
RemoteQueryDownloadAnalysisResultsMessage,
17-
RemoteQueryDownloadAllAnalysesResultsMessage,
18-
RemoteQueryViewAnalysisResultsMessage,
15+
RemoteQueryDownloadAllAnalysesResultsMessage
1916
} from '../pure/interface-types';
2017
import { Logger } from '../logging';
2118
import { getHtmlForWebview } from '../interface-utils';
@@ -204,9 +201,6 @@ export class RemoteQueriesInterfaceManager {
204201
case 'remoteQueryDownloadAllAnalysesResults':
205202
await this.downloadAllAnalysesResults(msg);
206203
break;
207-
case 'remoteQueryViewAnalysisResults':
208-
await this.viewAnalysisResults(msg);
209-
break;
210204
default:
211205
assertNever(msg);
212206
}
@@ -225,31 +219,6 @@ export class RemoteQueriesInterfaceManager {
225219
results => this.setAnalysisResults(results));
226220
}
227221

228-
private async viewAnalysisResults(msg: RemoteQueryViewAnalysisResultsMessage): Promise<void> {
229-
const downloadLink = msg.analysisSummary.downloadLink;
230-
const filePath = path.join(this.analysesResultsManager.storagePath, downloadLink.queryId, downloadLink.id, downloadLink.innerFilePath || '');
231-
232-
const sarifViewerExtensionId = 'MS-SarifVSCode.sarif-viewer';
233-
234-
const sarifExt = extensions.getExtension(sarifViewerExtensionId);
235-
if (!sarifExt) {
236-
// Ask the user if they want to install the extension to view the results.
237-
void commands.executeCommand('workbench.extensions.installExtension', sarifViewerExtensionId);
238-
return;
239-
}
240-
241-
if (!sarifExt.isActive) {
242-
await sarifExt.activate();
243-
}
244-
245-
// Clear any previous results before showing new results
246-
await sarifExt.exports.closeAllLogs();
247-
248-
await sarifExt.exports.openLogs([
249-
Uri.file(filePath),
250-
]);
251-
}
252-
253222
public async setAnalysisResults(analysesResults: AnalysisResults[]): Promise<void> {
254223
if (this.panel?.active) {
255224
await this.postMessage({

extensions/ql-vscode/src/remote-queries/view/RemoteQueries.tsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import DownloadButton from './DownloadButton';
1616
import { AnalysisResults } from '../shared/analysis-result';
1717
import DownloadSpinner from './DownloadSpinner';
1818
import CollapsibleItem from './CollapsibleItem';
19-
import { AlertIcon, CodeSquareIcon, FileCodeIcon, FileSymlinkFileIcon, RepoIcon, TerminalIcon } from '@primer/octicons-react';
19+
import { AlertIcon, CodeSquareIcon, FileCodeIcon, RepoIcon, TerminalIcon } from '@primer/octicons-react';
2020
import AnalysisAlertResult from './AnalysisAlertResult';
2121
import RawResultsTable from './RawResultsTable';
2222

@@ -52,13 +52,6 @@ const downloadAllAnalysesResults = (query: RemoteQueryResult) => {
5252
});
5353
};
5454

55-
const viewAnalysisResults = (analysisSummary: AnalysisSummary) => {
56-
vscode.postMessage({
57-
t: 'remoteQueryViewAnalysisResults',
58-
analysisSummary
59-
});
60-
};
61-
6255
const openQueryFile = (queryResult: RemoteQueryResult) => {
6356
vscode.postMessage({
6457
t: 'openFile',
@@ -160,7 +153,7 @@ const SummaryTitleNoResults = () => (
160153
</div>
161154
);
162155

163-
const SummaryItemDownloadAndView = ({
156+
const SummaryItemDownload = ({
164157
analysisSummary,
165158
analysisResults
166159
}: {
@@ -180,13 +173,7 @@ const SummaryItemDownloadAndView = ({
180173
</>;
181174
}
182175

183-
return <>
184-
<HorizontalSpace size={2} />
185-
<a className="vscode-codeql__analysis-result-file-link"
186-
onClick={() => viewAnalysisResults(analysisSummary)} >
187-
<FileSymlinkFileIcon size={16} />
188-
</a>
189-
</>;
176+
return <></>;
190177
};
191178

192179
const SummaryItem = ({
@@ -201,7 +188,7 @@ const SummaryItem = ({
201188
<span className="vscode-codeql__analysis-item">{analysisSummary.nwo}</span>
202189
<span className="vscode-codeql__analysis-item"><Badge text={analysisSummary.resultCount.toString()} /></span>
203190
<span className="vscode-codeql__analysis-item">
204-
<SummaryItemDownloadAndView
191+
<SummaryItemDownload
205192
analysisSummary={analysisSummary}
206193
analysisResults={analysisResults} />
207194
</span>

extensions/ql-vscode/src/remote-queries/view/remoteQueries.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
font-size: x-small;
3434
}
3535

36-
.vscode-codeql__analysis-result-file-link {
37-
vertical-align: middle;
38-
}
39-
4036
.vscode-codeql__analysis-failure {
4137
margin: 0;
4238
font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas,

0 commit comments

Comments
 (0)