Skip to content

Commit

Permalink
Do not post a pr review if no homoglyphs are found (#3364)
Browse files Browse the repository at this point in the history
update: do not post a pr review if no homoglyphs are found
  • Loading branch information
teodor-yanev committed May 20, 2024
1 parent 408e45b commit 1ccdb36
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ func NewHomoglyphsEvaluator(
}

// evaluateHomoglyphs is a helper function to evaluate the homoglyphs rule type
// Return parameters:
// - bool: whether the evaluation has found violations
// - error: an error if the evaluation failed
func evaluateHomoglyphs(
ctx context.Context,
processor domain.HomoglyphProcessor,
Expand Down Expand Up @@ -112,14 +115,9 @@ func evaluateHomoglyphs(
}
}

var reviewText string
var hasFoundViolations bool
if len(reviewHandler.GetComments()) > 0 {
reviewText = processor.GetFailedReviewText()
hasFoundViolations = true
} else {
reviewText = processor.GetPassedReviewText()
return true, reviewHandler.SubmitReview(ctx, processor.GetFailedReviewText())
}

return hasFoundViolations, reviewHandler.SubmitReview(ctx, reviewText)
return false, nil
}

0 comments on commit 1ccdb36

Please sign in to comment.