RFR: 1625: Validate input from /summary command [v3]

Erik Joelsson erikj at openjdk.org
Mon Oct 24 17:31:42 UTC 2022


On Fri, 21 Oct 2022 23:08:29 GMT, Zhao Song <zsong at openjdk.org> wrote:

>> 1.  Added validation to SummaryCommand.
>> 2. If exceptions are thrown when the bot is evaluating the current status of the pr, the exceptions will be treated as integration blocker.
>
> Zhao Song has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix a typo

bots/pr/src/main/java/org/openjdk/skara/bots/pr/PullRequestCheckIssueVisitor.java line 158:

> 156:     public void visit(InvalidReviewersIssue e) {
> 157:         var invalid = String.join(", ", e.invalid());
> 158:         throw new BadCommitMessageException("Invalid reviewers " + invalid);

I didn't mean for this new exception to be used everywhere. We were specifically trying to avoid just issues with the commit message here.

bots/pr/src/main/java/org/openjdk/skara/bots/pr/PullRequestCheckIssueVisitor.java line 245:

> 243:     public void visit(MessageIssue issue) {
> 244:         var message = String.join("\n", issue.commit().message());
> 245:         throw new BadCommitMessageException("Incorrectly formatted commit message: " + message);

Looking more at this, communicating through an exception seems wrong. The visitor already has a way to communicate problems through the addFailureMessage method. We should just stop throwing exception and treat this as any other "normal" failure.

bots/pr/src/main/java/org/openjdk/skara/bots/pr/SummaryCommand.java line 61:

> 59:                         summary +
> 60:                         "\n```\n" +
> 61:                         "A summary line cannot start with any of the following: `<issue-id>:`, `Co-authored-by:`, `Reviewed-by:`, `Backport-of:`. See [JEP 357](https://openjdk.org/jeps/357) for details.");

Please break this long line.

-------------

PR: https://git.openjdk.org/skara/pull/1401


More information about the skara-dev mailing list