I am adding Checkstyle to my project, but the rule for detecting spaces is not enough (RegexpSingleline):
(?<=\S)\s+$
It detects trailing spaces and ignores only lines with spaces (it must allow nested empty lines). It works fine fine, but it complains about javadoc / multi-line comments using an empty line:
/** * Some text * * More text */
The empty line between the two lines is "asterisk-whitespace" (the default formatting is Eclipse), thereby invoking this rule, and so far I have not been able to force it to ignore this special situation. How can I fix this regex for this case?
Thanks!
Note: there is no need to be multi-line check and check whether the line is really part of the comment, it is thin enough as a separate line.
Summing up the desired rules ...
The regular expression should match lines with trailing spaces:
x = y; void function() {
Except in cases where there is nothing in the line except spaces (in this exception, only one asterisk is allowed up to the last space, but ONLY when the asterisk is the only non-space char):
(only whitespaces here, all ok) /** * (this text is not here, and this line is ok - this case is my uncovered situation) */
source share