Since Checkstyle 8.33
To configure the check:
<module name="Checker">
<module name="TreeWalker">
<module name="NoCodeInFile"/>
</module>
</module>
Example:
/* the violation is on first line of file */
// public class Example1 {
// single-line comment is not code
// }
Example:
/* the violation is on first line of file */
/*
public class Example2 {
block comment is not code
}
*/
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