Skip to content

Commit

Permalink
fix: root tree node texts for snyk code
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiandoetsch committed Feb 21, 2024
1 parent 79268a5 commit 03441b8
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SnykToolWindowSnykCodeScanListenerLS(
val securityResults = snykCodeResults
.map { it.key to it.value.filter { issue -> issue.additionalData.isSecurityType } }
.toMap()
securityIssuesCount = securityResults.size
securityIssuesCount = securityResults.values.flatten().distinct().size
securityIssuesHMLPostfix = buildHMLpostfix(securityResults)

if (pluginSettings().treeFiltering.codeSecurityResults) {
Expand Down Expand Up @@ -104,7 +104,7 @@ class SnykToolWindowSnykCodeScanListenerLS(
val qualityResults = snykCodeResults
.map { it.key to it.value.filter { issue -> !issue.additionalData.isSecurityType } }
.toMap()
qualityIssuesCount = qualityResults.size
qualityIssuesCount = qualityResults.values.flatten().distinct().size
qualityIssuesHMLPostfix = buildHMLpostfix(qualityResults)

if (pluginSettings().treeFiltering.codeQualityResults) {
Expand Down Expand Up @@ -160,10 +160,9 @@ class SnykToolWindowSnykCodeScanListenerLS(
}

private fun buildHMLpostfix(securityResults: Map<SnykCodeFile, List<ScanIssue>>): String {
val critical = securityResults.values.flatten().count { it.getSeverityAsEnum() == Severity.CRITICAL }
val high = securityResults.values.flatten().count { it.getSeverityAsEnum() == Severity.HIGH }
val medium = securityResults.values.flatten().count { it.getSeverityAsEnum() == Severity.MEDIUM }
val low = securityResults.values.flatten().count { it.getSeverityAsEnum() == Severity.LOW }
return " ($critical/$high/$medium/$low)"
return ": $high high, $medium medium, $low low"
}
}

0 comments on commit 03441b8

Please sign in to comment.