diff --git a/docs/config_blocks.html b/docs/config_blocks.html index d917c9cdb..4cd32c3a2 100644 --- a/docs/config_blocks.html +++ b/docs/config_blocks.html @@ -34,6 +34,9 @@
  • RightCurly
  • +
  • + AvoidNestedBlocks +
  • @@ -250,6 +253,57 @@

    TreeWalker

    + +

    AvoidNestedBlocks

    Description

    +

    + Finds nested blocks, i.e. blocks that are used freely in the code. + For example this Check finds the obsolete braces in +

    +
    + switch (a)
    + {
    +     case 0:
    +         {
    +             x = 1;
    +         }
    +         break;
    +     default:
    +         break;
    + }
    +      
    +

    + and flags confusing code like +

    +
    + public void guessTheOutput()
    + {
    +     int whichIsWich = 0;
    +     {
    +         int whichIsWhich = 2;
    +     }
    +     System.out.println("value = " + whichIsWhich);
    + }
    + 
    +

    + Rationale: Nested blocks are often leftovers from the debugging process, they confuse + the reader. +

    +

    Examples

    +

    + To configure the check: +

    +
    +<module name="AvoidNestedBlocks"/>
    +      
    +

    Package

    +

    + com.puppycrawl.tools.checkstyle.checks +

    +

    Parent Module

    +

    + TreeWalker +

    +