Class BracketsStructureCheck

  • All Implemented Interfaces:,

    public final class BracketsStructureCheck
    Checks node/closing brackets to be the last symbols on the line.

    This is how a correct bracket structure should look like:

     String text = String.format(
       "some text: %s",
       new Foo().with(

    The motivation for such formatting is simple - we want to see the entire block as fast as possible. When you look at a block of code you should be able to see where it starts and where it ends. In exactly the same way we organize curled brackets.

    In other words, when you open a bracket and can't close it at the same line - you should leave it as the last symbol at this line.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class
    • Method Summary

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

        beginTree, clearViolations, destroy, finishTree, 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

      • BracketsStructureCheck

        public BracketsStructureCheck()
    • 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