RFR: Treat bad whitespace in commit message gracefully

Erik Helin ehelin at openjdk.java.net
Fri Sep 11 07:13:20 UTC 2020


On Fri, 11 Sep 2020 07:07:39 GMT, Robin Westberg <rwestberg at openjdk.org> wrote:

> The check "message" should handle the error gracefully instead of throwing. Also trim individual lines in multi-line
> summaries to help avoid this problem in the first place.
> Best regards,
> Robin

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

> 202:     @Override
> 203:     public void visit(MessageWhitespaceIssue issue) {
> 204:         addFailureMessage(issue.check(), "The commit message contains bad whitespace");

Suggestion:

        String desc = null;
        if (issue.kind() == MessageWhitespaceIssue.Whitespace.TRAILING) {
            desc = "trailing whitespace";
        } else if (issue.kind() == MessageWhitespaceIssue.Whitespace.CR) {
            desc = "a carriage return";
        } else {
            desc = "a tab";
        }
        addFailureMessage(issue.check(), "The commit message contains " + desc + " on line " + issue.line());

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

PR: https://git.openjdk.java.net/skara/pull/814


More information about the skara-dev mailing list