Skip to content

Commit

Permalink
analyzer:fix - Fixing details wrong (#1054)
Browse files Browse the repository at this point in the history
Signed-off-by: Wilian Gabriel <[email protected]>
  • Loading branch information
wiliansilvazup authored Apr 7, 2022
1 parent c7af3b3 commit 39d4c9c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/controllers/analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package analyzer

import (
"bytes"
"fmt"
"strings"
"time"
Expand Down Expand Up @@ -505,7 +504,7 @@ func (a *Analyzer) setCounterOfDetailsDuplicated(
) (newAnalysisVulnerabilities []analysis.AnalysisVulnerabilities) {
for indexAV := range analysisVulnerabilities {
currentAV := analysisVulnerabilities[indexAV]
newDetails := bytes.NewBufferString("")
newDetails := ""
detailEmptySplit := strings.Split(currentAV.Vulnerability.Details, detailsHeaderText)
detailToSetSplit := make([]string, 0)
for _, d := range detailEmptySplit {
Expand All @@ -518,10 +517,10 @@ func (a *Analyzer) setCounterOfDetailsDuplicated(
if indexDS+1 == len(detailToSetSplit) {
lastChar = ""
}
_, _ = fmt.Fprintf(newDetails, "%s(%v/%v) %s%s%s", newDetails, indexDS+1, len(detailToSetSplit),
newDetails = fmt.Sprintf("%s(%v/%v) %s%s%s", newDetails, indexDS+1, len(detailToSetSplit),
detailsHeaderText, detail, lastChar)
}
currentAV.Vulnerability.Details = newDetails.String()
currentAV.Vulnerability.Details = newDetails
newAnalysisVulnerabilities = append(newAnalysisVulnerabilities, currentAV)
}
return newAnalysisVulnerabilities
Expand Down

0 comments on commit 39d4c9c

Please sign in to comment.