Skip to content

Commit d052ddb

Browse files
authored
Rename analysis alert results (#1197)
1 parent af53a02 commit d052ddb

5 files changed

Lines changed: 27 additions & 27 deletions

File tree

extensions/ql-vscode/src/remote-queries/analyses-results-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class AnalysesResultsManager {
101101
const analysisResults: AnalysisResults = {
102102
nwo: analysis.nwo,
103103
status: 'InProgress',
104-
results: []
104+
interpretedResults: []
105105
};
106106
const queryId = analysis.downloadLink.queryId;
107107
const resultsForQuery = this.internalGetAnalysesResults(queryId);
@@ -123,7 +123,7 @@ export class AnalysesResultsManager {
123123
const queryResults = await this.readResults(artifactPath);
124124
newAnaysisResults = {
125125
...analysisResults,
126-
results: queryResults,
126+
interpretedResults: queryResults,
127127
status: 'Completed'
128128
};
129129
} else {

extensions/ql-vscode/src/remote-queries/sample-data.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const sampleRemoteQueryResult: RemoteQueryResult = {
9999
};
100100

101101

102-
const createAnalysisResults = (n: number) => Array(n).fill(
102+
const createAnalysisInterpretedResults = (n: number) => Array(n).fill(
103103
{
104104
message: 'This shell command depends on an uncontrolled [absolute path](1).',
105105
shortDescription: 'Shell command built from environment values',
@@ -317,18 +317,18 @@ export const sampleAnalysesResultsStage1: AnalysisResults[] = [
317317
{
318318
nwo: 'big-corp/repo1',
319319
status: 'InProgress',
320-
results: []
320+
interpretedResults: []
321321
},
322322
{
323323
nwo: 'big-corp/repo2',
324324
status: 'InProgress',
325-
results: []
325+
interpretedResults: []
326326

327327
},
328328
{
329329
nwo: 'big-corp/repo3',
330330
status: 'InProgress',
331-
results: []
331+
interpretedResults: []
332332
},
333333
// No entries for repo4
334334
];
@@ -337,67 +337,67 @@ export const sampleAnalysesResultsStage2: AnalysisResults[] = [
337337
{
338338
nwo: 'big-corp/repo1',
339339
status: 'Completed',
340-
results: createAnalysisResults(85)
340+
interpretedResults: createAnalysisInterpretedResults(85)
341341
},
342342
{
343343
nwo: 'big-corp/repo2',
344344
status: 'Completed',
345-
results: createAnalysisResults(20)
345+
interpretedResults: createAnalysisInterpretedResults(20)
346346
},
347347
{
348348
nwo: 'big-corp/repo3',
349349
status: 'InProgress',
350-
results: []
350+
interpretedResults: []
351351
},
352352
{
353353
nwo: 'big-corp/repo4',
354354
status: 'InProgress',
355-
results: []
355+
interpretedResults: []
356356
},
357357
];
358358

359359
export const sampleAnalysesResultsStage3: AnalysisResults[] = [
360360
{
361361
nwo: 'big-corp/repo1',
362362
status: 'Completed',
363-
results: createAnalysisResults(85)
363+
interpretedResults: createAnalysisInterpretedResults(85)
364364
},
365365
{
366366
nwo: 'big-corp/repo2',
367367
status: 'Completed',
368-
results: createAnalysisResults(20)
368+
interpretedResults: createAnalysisInterpretedResults(20)
369369
},
370370
{
371371
nwo: 'big-corp/repo3',
372372
status: 'Completed',
373-
results: createAnalysisResults(8)
373+
interpretedResults: createAnalysisInterpretedResults(8)
374374
},
375375
{
376376
nwo: 'big-corp/repo4',
377377
status: 'Completed',
378-
results: createAnalysisResults(3)
378+
interpretedResults: createAnalysisInterpretedResults(3)
379379
},
380380
];
381381

382382
export const sampleAnalysesResultsWithFailure: AnalysisResults[] = [
383383
{
384384
nwo: 'big-corp/repo1',
385385
status: 'Completed',
386-
results: createAnalysisResults(85)
386+
interpretedResults: createAnalysisInterpretedResults(85)
387387
},
388388
{
389389
nwo: 'big-corp/repo2',
390390
status: 'Completed',
391-
results: createAnalysisResults(20)
391+
interpretedResults: createAnalysisInterpretedResults(20)
392392
},
393393
{
394394
nwo: 'big-corp/repo3',
395395
status: 'Failed',
396-
results: []
396+
interpretedResults: []
397397
},
398398
{
399399
nwo: 'big-corp/repo4',
400400
status: 'Completed',
401-
results: createAnalysisResults(3)
401+
interpretedResults: createAnalysisInterpretedResults(3)
402402
},
403403
];

extensions/ql-vscode/src/remote-queries/shared/analysis-result.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export type AnalysisResultStatus = 'InProgress' | 'Completed' | 'Failed';
33
export interface AnalysisResults {
44
nwo: string;
55
status: AnalysisResultStatus;
6-
results: AnalysisAlert[];
6+
interpretedResults: AnalysisAlert[];
77
}
88

99
export interface AnalysisAlert {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const openQueryTextVirtualFile = (queryResult: RemoteQueryResult) => {
7373
};
7474

7575
const sumAnalysesResults = (analysesResults: AnalysisResults[]) =>
76-
analysesResults.reduce((acc, curr) => acc + curr.results.length, 0);
76+
analysesResults.reduce((acc, curr) => acc + curr.interpretedResults.length, 0);
7777

7878
const QueryInfo = (queryResult: RemoteQueryResult) => (
7979
<>
@@ -264,13 +264,13 @@ const AnalysesResultsDescription = ({ totalAnalysesResults, totalResults }: { to
264264
const RepoAnalysisResults = (analysisResults: AnalysisResults) => {
265265
const title = <>
266266
{analysisResults.nwo}
267-
<Badge text={analysisResults.results.length.toString()} />
267+
<Badge text={analysisResults.interpretedResults.length.toString()} />
268268
</>;
269269

270270
return (
271271
<CollapsibleItem title={title}>
272272
<ul className="vscode-codeql__flat-list" >
273-
{analysisResults.results.map((r, i) =>
273+
{analysisResults.interpretedResults.map((r, i) =>
274274
<li key={i}>
275275
<AnalysisAlertResult alert={r} />
276276
<VerticalSpace size={2} />
@@ -297,7 +297,7 @@ const AnalysesResults = ({ analysesResults, totalResults }: { analysesResults: A
297297
totalAnalysesResults={totalAnalysesResults}
298298
totalResults={totalResults} />
299299
<ul className="vscode-codeql__flat-list">
300-
{analysesResults.filter(a => a.results.length > 0).map(r =>
300+
{analysesResults.filter(a => a.interpretedResults.length > 0).map(r =>
301301
<li key={r.nwo} className="vscode-codeql__analyses-results-list-item">
302302
<RepoAnalysisResults {...r} />
303303
</li>)}

extensions/ql-vscode/src/vscode-tests/no-workspace/remote-query-history.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,22 +211,22 @@ describe('Remote queries and query history manager', function() {
211211
expect(publisher.getCall(0).args[0][0]).to.include({
212212
nwo: 'github/vscode-codeql',
213213
status: 'InProgress',
214-
// results: ... avoid checking the results object since it is complex
214+
// interpretedResults: ... avoid checking the interpretedResults object since it is complex
215215
});
216216

217217
// second time, it has the path to the sarif file.
218218
expect(publisher.getCall(1).args[0][0]).to.include({
219219
nwo: 'github/vscode-codeql',
220220
status: 'Completed',
221-
// results: ... avoid checking the results object since it is complex
221+
// interpretedResults: ... avoid checking the interpretedResults object since it is complex
222222
});
223223
expect(publisher).to.have.been.calledTwice;
224224

225225
// result should be stored in the manager
226226
expect(arm.getAnalysesResults(rawQueryHistory[0].queryId)[0]).to.include({
227227
nwo: 'github/vscode-codeql',
228228
status: 'Completed',
229-
// results: ... avoid checking the results object since it is complex
229+
// interpretedResults: ... avoid checking the interpretedResults object since it is complex
230230
});
231231
publisher.resetHistory();
232232

@@ -242,7 +242,7 @@ describe('Remote queries and query history manager', function() {
242242
await arm.downloadAnalysesResults(analysisSummaries, undefined, publisher);
243243

244244
const trimmed = publisher.getCalls().map(call => call.args[0]).map(args => {
245-
args.forEach((analysisResult: any) => delete analysisResult.results);
245+
args.forEach((analysisResult: any) => delete analysisResult.interpretedResults);
246246
return args;
247247
});
248248

0 commit comments

Comments
 (0)