RFR: 2278: Issuestitle Check shouldn't treat special character as leading lowercase letter
Zhao Song
zsong at openjdk.org
Tue Jun 4 18:33:11 UTC 2024
On Tue, 4 Jun 2024 18:21:37 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
> This change will fix this specific problem, but I wonder if it would be better to step back and rethink this check. The main thing this check is trying to catch is the case of an all lower-case initial word, so I would test for _that_ rather than checking that the initial word starts with a lower-case letter and doesn't contain certain other characters.
>
> Something like this:
>
> ```
> Pattern ALL_LOWER_CASE = Pattern.compile("[a-z]+");
> ...
>
> boolean hasLeadingLowerCaseWord(String description) {
> var firstWord = description.split(" ")[0];
> return ALL_LOWER_CASE.matcher(description).matches();
> }
> ```
>
> Then you can get rid of the `FILE_OR_FUNCTION_PATTERN` regex.
>
> This has the benefit of not warning on any camel case word (e.g., "macOS") and also means you won't have to keep adding special characters to the `FILE_OR_FUNCTION_PATTERN` (which I predict you will otherwise have to do at some point)
Seems like it's a good idea. I will think of it. Thank you!
-------------
PR Comment: https://git.openjdk.org/skara/pull/1656#issuecomment-2148159023
More information about the skara-dev
mailing list