I am attempting to create a custom CheckStyle in IntelliJ IDEA(with Maven)that will enforce the following rule: a period after every single comment
I've looked at this post Custom Checkstyle Check Nesting Isssue, and seen that whitespace does not count as a token. I am not sure how to parse the comments and check for the period.
I am extending the puppycrawl Checkstyle tools and using the visitToken method for the implementation. In the checkstyle.xml I am adding my check into the TreeWalker module of the Checker module.
Does anyone have any theories on how to accomplish this? Thanks
I suggest to examine the existing checkers (just like in the linked post), it is very likely that you can find one which is quite close to the expected behaviour.
E.g. TrailingComment check in your case.
With this configuration (snippet):
For the following Java code:
This report will be produced:
Or - if this is not exactly what you need - you can create a new checker based on the TrailingCommentCheck class.