Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Sep 11, 2023
1 parent 535f926 commit 7f76ff2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion utils/outputwriter/simplifiedoutput.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Finding: %s
`,
)
dataFlowId = dataFlowId + 1
dataFlowId++
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions utils/reviewcomment.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func AddReviewComments(repo *Repository, pullRequestID int, client vcsclient.Vcs
}
}
// Add review comments for the given data
commentsToAdd, err := getNewReviewComments(repo, pullRequestID, client, vulnerabilitiesRows, applicableIssues, iacIssues, sastIssues)
commentsToAdd, err := getNewReviewComments(repo, vulnerabilitiesRows, applicableIssues, iacIssues, sastIssues)
if err != nil {
return
}
Expand All @@ -70,7 +70,7 @@ func getFrogbotReviewComments(existingComments []vcsclient.CommentInfo) (reviewC
return
}

func getNewReviewComments(repo *Repository, pullRequestID int, client vcsclient.VcsClient, vulnerabilitiesRows []formats.VulnerabilityOrViolationRow, applicableIssues, iacIssues, sastIssues *sarif.Run) (commentsToAdd []vcsclient.PullRequestComment, err error) {
func getNewReviewComments(repo *Repository, vulnerabilitiesRows []formats.VulnerabilityOrViolationRow, applicableIssues, iacIssues, sastIssues *sarif.Run) (commentsToAdd []vcsclient.PullRequestComment, err error) {
writer := repo.OutputWriter

if len(applicableIssues.Results) > 0 {
Expand All @@ -95,18 +95,18 @@ func getNewReviewComments(repo *Repository, pullRequestID int, client vcsclient.
}
commentsToAdd = append(commentsToAdd, comments...)
}

return
}

func generateCommentsForType(commentType ReviewCommentType, data *sarif.Run, writer outputwriter.OutputWriter) (commentsToAdd []vcsclient.PullRequestComment, err error) {
for _, result := range data.Results {
for _, location := range result.Locations {
log.Debug("Adding new review comment", location)
var rule *sarif.ReportingDescriptor
if rule, err = data.GetRuleById(*result.RuleID); err != nil {
return
}
log.Debug("Adding new review comment", xrayutils.GetLocationFileName(location))
var rule *sarif.ReportingDescriptor
if rule, err = data.GetRuleById(*result.RuleID); err != nil {
return
}
commentsToAdd = append(commentsToAdd, generateReviewComment(location, commentType, result, rule, writer))
}
}
Expand Down

0 comments on commit 7f76ff2

Please sign in to comment.