Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not post a pr review if no homoglyphs are found #3364

Merged
merged 1 commit into from
May 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}