Skip to content

Commit

Permalink
Merge pull request #4110 from snyk/fix/undefined-ignored-issues-count
Browse files Browse the repository at this point in the history
fix: Ignored issues count displays "undefined"
  • Loading branch information
francescomari authored Oct 6, 2022
2 parents b0c0789 + 962df51 commit 61c983d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/lib/formatters/iac-output/text/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function formatSnykIacTestTestData(
const filesWithIssuesCount = countFilesWithIssues(snykIacTestScanResult);
const filesWithoutIssuesCount = allFilesCount - filesWithIssuesCount;
const ignores = snykIacTestScanResult
? snykIacTestScanResult.scanAnalytics.ignoredCount
? snykIacTestScanResult.metadata.ignoredCount
: 0;

let contextSuppressedIssueCount: number | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/iac/test/v2/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function computeIacAnalytics(testOutput: TestOutput): IacAnalytics {
iacType,
packageManager: Object.keys(iacType) as ResourceKind[],
iacIssuesCount: testOutput.results?.vulnerabilities?.length || 0,
iacIgnoredIssuesCount: testOutput.results?.scanAnalytics.ignoredCount || 0,
iacIgnoredIssuesCount: testOutput.results?.metadata.ignoredCount || 0,
iacFilesCount: Object.values(iacType).reduce(
(acc, packageManagerAnalytics) => acc + packageManagerAnalytics!.count,
0,
Expand Down
1 change: 1 addition & 0 deletions src/lib/iac/test/v2/scan/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface Results {

export interface Metadata {
projectName: string;
ignoredCount: number;
}

export interface ScanAnalytics {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@
}
],
"metadata": {
"projectName": "input-files-for-json-v2"
"projectName": "input-files-for-json-v2",
"ignoredCount": 3
},
"scanAnalytics": {
"suppressedResults": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@
}
],
"metadata": {
"projectName": "input-files-for-json-v2"
},
"scanAnalytics": {
"projectName": "input-files-for-json-v2",
"ignoredCount": 3
}
},
Expand Down

0 comments on commit 61c983d

Please sign in to comment.