Class NoCodeInFileCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable

    public class NoCodeInFileCheck
    extends AbstractCheck

    Checks whether file contains code. Files which are considered to have no code:

    • File with no text
    • File with single line comment(s)
    • File with a multi line comment(s).

    To configure the check:

     <module name="NoCodeInFile"/>
     

    Example:

    Content of the files:

     // single line comment // violation
     
     /* // violation
      block comment
     */
     

    Parent is com.puppycrawl.tools.checkstyle.TreeWalker

    Violation Message Keys:

    • nocode.in.file
    Since:
    8.33