RFR: 912: PR title correction logic can get stuck [v2]

Robin Westberg rwestberg at openjdk.java.net
Fri Mar 12 08:20:19 UTC 2021


On Thu, 11 Mar 2021 13:58:58 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckWorkItem.java line 173:
>> 
>>> 171:             var issue = project.issue(id);
>>> 172:             if (issue.isPresent()) {
>>> 173:                 var issueTitle = issue.get().title().strip();
>> 
>> The title() method is called in a lot of places, perhaps it would be better to perform the stripping closer to the source?
>
> I'm not sure what you mean by that? We did use `issue.get().title()` in lots of places, but I replaced them with `issueTitle `to only have a single strip. That's as close to the source I can see possible.

I was thinking of usages outside of this particular function, perhaps like https://github.com/openjdk/skara/blob/dbef34b8c9785ec185a70365324063a02b1ec010/bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckWorkItem.java#L256 - we probably don't want trailing tabs or spaces there either.. So instead of searching for more of these, my suggestion was to add a call to strip before returning from the title() method to avoid similar problems.

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

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


More information about the skara-dev mailing list