Class FileLengthCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable, FileSetCheck

    public class FileLengthCheck
    extends AbstractFileSetCheck

    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.

    • Property fileExtensions - Specify the file extensions of the files to process. Type is java.lang.String[]. Default value is "".
    • Property max - Specify the maximum number of lines allowed. Type is int. Default value is 2000.

    Parent is com.puppycrawl.tools.checkstyle.Checker

    Violation Message Keys:

    • maxLen.file
    Since:
    5.0
    • Method Detail

      • setMax

        public void setMax​(int length)
        Setter to specify the maximum number of lines allowed.
        Parameters:
        length - the maximum length of a Java source file
        Since:
        3.2