Since Checkstyle 8.33
Checks whether file contains code. Files which are considered to have no code:
To configure the check:
<module name="Checker"> <module name="TreeWalker"> <module name="NoCodeInFile"/> </module> </module>
Example:
Content of the files:
// single-line comment // violation
Example:
/* // violation block comment */
All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.
com.puppycrawl.tools.checkstyle.checks