1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="NestedForDepth"/> 5 </module> 6 </module> 7 */ 8 package com.puppycrawl.tools.checkstyle.checks.coding.nestedfordepth; 9 10 // xdoc section -- start 11 public class Example1 { 12 13 public void myTest() { 14 for(int i=0; i<10; i++) { 15 for(int j=0; j<i; j++) { 16 } 17 } 18 19 // violation 3 lines below 'Nested for depth is 2 (max allowed is 1).' 20 for(int i=0; i<10; i++) { 21 for(int j=0; j<i; j++) { 22 for(int k=0; k<j; k++) { 23 } 24 } 25 } 26 27 // violation 4 lines below 'Nested for depth is 2 (max allowed is 1).' 28 // violation 4 lines below 'Nested for depth is 3 (max allowed is 1).' 29 for(int i=0; i<10; i++) { 30 for(int j=0; j<i; j++) { 31 for(int k=0; k<j; k++) { 32 for(int l=0; l<k; l++) { 33 } 34 } 35 } 36 } 37 } 38 } 39 // xdoc section -- end