Since Checkstyle 5.0


Checks for long source files.

Rationale: If a source file becomes very long it is hard to understand. Therefore, long classes should usually be refactored into several individual classes that focus on a specific task.


name description type default value since
max Specify the maximum number of lines allowed. int 2000 3.2
fileExtensions Specify the file type extension of files to process. String[] all files 5.0


To configure the check:

<module name="Checker">
  <module name="FileLength"/>

To configure the check to accept files with up to 1500 lines:

<module name="Checker">
  <module name="FileLength">
    <property name="max" value="1500"/>

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.


Parent Module