Class EmptyLinesCheck

  • All Implemented Interfaces:,

    public final class EmptyLinesCheck
    Check for empty lines inside methods and constructors.

    We believe that comments and empty lines are evil. If you need to use an empty line in order to add a vertical separator of concepts - refactor your code and make it more cohesive and readable. The bottom line is that every method should look solid and do just one thing. This class is thread safe. It relies on building a list of line ranges by visiting each method definition and each anonymous inner type. It stores these references in a non-static thread local.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class
    • Constructor Summary

      Constructor Description
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void finishTree​( root)  
      int[] getAcceptableTokens()  
      int[] getDefaultTokens()  
      int[] getRequiredTokens()  
      void visitToken​( ast)  
      • Methods inherited from class

        beginTree, clearViolations, destroy, getFileContents, getFilePath, getLine, getLineCodePoints, getLines, getTabWidth, getTokenNames, getViolations, init, isCommentNodesRequired, leaveToken, log, log, log, setFileContents, setTabWidth, setTokens
      • Methods inherited from class

        finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverity
      • Methods inherited from class

        configure, contextualize, getConfiguration, setupChild
    • Constructor Detail

      • EmptyLinesCheck

        public EmptyLinesCheck()
    • Method Detail

      • getDefaultTokens

        public int[] getDefaultTokens()
        Specified by:
        getDefaultTokens in class
      • getAcceptableTokens

        public int[] getAcceptableTokens()
        Specified by:
        getAcceptableTokens in class
      • getRequiredTokens

        public int[] getRequiredTokens()
        Specified by:
        getRequiredTokens in class
      • visitToken

        public void visitToken​( ast)
        visitToken in class
      • finishTree

        public void finishTree​( root)
        finishTree in class