NoWhitespaceBefore but allow ,\n; for enums

11 views
Skip to first unread message

Tobias Olsson

unread,
Jun 14, 2017, 1:51:45 AM6/14/17
to checkstyle
I'm pretty new to configuring checkstyle, so please be patient with me.

I've got a rule-file that works well enough, but I would like to allow the following

public enum X {
    Y
,
    Z
,
   
;
}


but otherwise keep the default rules for NoWhitespaceAfter and NoWhitespaceBefore. The reason is that
I like the cleaner way the git blame (ehrm... "git annotations") works when you don't have to change the line above to add another enum.

The above snippet will generate a  
';' is preceded with whitespace. [NoWhitespaceBefore]

Is there any way to do this or do I need to add a custom rule?

Best Regards
/Tobias

Roman Ivanov

unread,
Jun 14, 2017, 3:24:30 PM6/14/17
to Tobias Olsson, checkstyle
Hi Tobias,

it looks like the same as questions as at https://github.com/checkstyle/checkstyle/issues/3767
thanks,
Roman Ivanov

Tobias Olsson

unread,
Jun 15, 2017, 2:10:19 AM6/15/17
to Roman Ivanov, checkstyle
Yes, it does. It's exactly what I'm looking for.

Thanks. It's much better described in the issue, and for what it's worth, yes, I would also like the newline without comma to be an error.

Best regards
/Tobias

Roman Ivanov

unread,
Jun 15, 2017, 8:26:47 AM6/15/17
to Tobias Olsson, checkstyle
Please put your preference to GitHub issue.
Reply all
Reply to author
Forward
0 new messages