Skip to content

Commit

Permalink
Fix sorting table results when no JAS scan (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas authored Sep 4, 2024
1 parent aea8b7c commit 8c43a37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions utils/resultwriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,23 +242,23 @@ func TestConvertXrayScanToSimpleJson(t *testing.T) {
Summary: "summary-1",
IssueId: "XRAY-1",
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "High"},
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15},
ImpactedDependencyName: "component-A",
},
},
{
Summary: "summary-1",
IssueId: "XRAY-1",
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "High"},
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15},
ImpactedDependencyName: "component-B",
},
},
{
Summary: "summary-2",
IssueId: "XRAY-2",
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "Low"},
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 9},
ImpactedDependencyName: "component-B",
},
},
Expand Down Expand Up @@ -288,15 +288,15 @@ func TestConvertXrayScanToSimpleJson(t *testing.T) {
Summary: "summary-1",
IssueId: "XRAY-1",
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "High"},
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15},
ImpactedDependencyName: "component-A",
},
},
{
Summary: "summary-1",
IssueId: "XRAY-1",
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "High"},
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15},
ImpactedDependencyName: "component-B",
},
},
Expand All @@ -305,7 +305,7 @@ func TestConvertXrayScanToSimpleJson(t *testing.T) {
{
LicenseKey: "license-1",
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "Low"},
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 9},
ImpactedDependencyName: "component-B",
},
},
Expand Down
4 changes: 4 additions & 0 deletions utils/severityutils/severity.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ func ParseToSeverityDetails(severity string, sarifSeverity, pretty bool, applica
// -- Getters functions (With default values) --

func GetAsDetails(severity Severity, applicabilityStatus jasutils.ApplicabilityStatus, pretty bool) formats.SeverityDetails {
if applicabilityStatus == jasutils.NotScanned {
// Pass 'NotCovered' as default value to get priority, since 'NotScanned' returns 0 priority for all severities
applicabilityStatus = jasutils.NotCovered
}
return GetSeverityDetails(severity, applicabilityStatus).ToDetails(severity, pretty)
}

Expand Down

0 comments on commit 8c43a37

Please sign in to comment.