RFR: 2278: Issuestitle Check shouldn't treat special character as leading lowercase letter
Kevin Rushforth
kcr at openjdk.org
Tue Jun 4 18:23:41 UTC 2024
On Tue, 4 Jun 2024 17:09:46 GMT, Zhao Song <zsong at openjdk.org> wrote:
> Currently, in IssuesTitleCheck::hasLeadingLowercaseLetter, the method checks if the leading character is uppercase, if so, it returns false. Otherwise, it will treat the character as lowercase. This is wrong because it treats special characters as lowercase letters. The solution is to make the method to check if the leading character is a lowercase letter.
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)
-------------
PR Comment: https://git.openjdk.org/skara/pull/1656#issuecomment-2148140420
More information about the skara-dev
mailing list