View Javadoc
1   /*
2   ReturnCount
3   max = (default)2
4   maxForVoid = 0
5   format = (default)^equals$
6   tokens = (default)CTOR_DEF, METHOD_DEF, LAMBDA
7   
8   
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.coding.returncount;
12  
13  class InputReturnCountVoid {
14      public InputReturnCountVoid() { // violation 'Return count is 1'
15          return;
16      }
17  
18      public void method() { // violation 'Return count is 1'
19          if (true) {
20              return;
21          }
22      }
23  
24      public void method2() { // violation 'Return count is 2'
25          if (true) {
26              return;
27          }
28  
29          return;
30      }
31  
32      public int method3() {
33          if (true) {
34              return 0;
35          }
36  
37          return 0;
38      }
39  
40      public int method4() { // violation 'Return count is 3'
41          if (true) {
42              return 0;
43          }
44          if (false) {
45              return 0;
46          }
47  
48          return 0;
49      }
50  
51      void method5() { // violation 'Return count is 2'
52          if (true) {
53              return;
54          }
55  
56          return;
57      }
58  }