NoCodeInFile

Since Checkstyle 8.33

Description

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).

Examples

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
*/
        

Example of Usage

Violation Messages

All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.

Package

com.puppycrawl.tools.checkstyle.checks

Parent Module

TreeWalker