aboutsummaryrefslogtreecommitdiff
path: root/src/xdocs/config_metrics.xml
blob: 2f71e45bb299754e9d22ad357405af1513208027 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
<?xml version="1.0" encoding="UTF-8"?>

<document xmlns="http://maven.apache.org/XDOC/2.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">

  <head>
    <title>Metrics</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/>
    <script type="text/javascript" src="js/anchors.js"/>
    <script type="text/javascript" src="js/google-analytics.js"/>
    <link rel="icon" href="images/favicon.png" type="image/x-icon" />
    <link rel="shortcut icon" href="images/favicon.ico" type="image/ico" />
  </head>

  <body>
    <section name="Content">
      <macro name="toc">
        <param name="fromDepth" value="1"/>
        <param name="toDepth" value="1"/>
      </macro>
    </section>

    <section name="BooleanExpressionComplexity">
      <subsection name="Description">
        <p>
          Restrict the number of number of <code>&#x26;&#x26;</code>, <code>||</code>,
          <code>&#x26;</code>, <code>|</code>
          and <code>^</code> in an expression.
        </p>

        <p>
          Rationale: Too many conditions leads to code that is difficult
          to read and hence debug and maintain.
        </p>

        <p>
          Note that the operators <code>&#x26;</code> and
          <code>|</code> are not only integer bitwise operators, they are also the
          <a href="http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.22.2">
          non-shortcut versions</a> of the boolean operators.
          <code>&#x26;&#x26;</code> and <code>||</code>.
        </p>
        <p>
          Note that <code>&#x26;</code>, <code>|</code> and <code>^</code> are not checked
          if they are part of constructor or method call
          because they can be applied to non boolean variables and
          Checkstyle does not know types of methods from different classes.
        </p>
      </subsection>

      <subsection name="Properties">
        <table>
          <tr>
            <th>name</th>
            <th>description</th>
            <th>type</th>
            <th>default value</th>
          </tr>
          <tr>
            <td>max</td>
            <td>
              the maximum allowed number of boolean operations in one
              expression.
            </td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>3</code></td>
          </tr>
          <tr>
            <td>tokens</td>
            <td>tokens to check</td>
            <td>
              subset of tokens
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LAND">LAND</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#BAND">BAND</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LOR">LOR</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#BOR">BOR</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#BXOR">BXOR</a>.
            </td>
            <td>
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LAND">LAND</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#BAND">BAND</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LOR">LOR</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#BOR">BOR</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#BXOR">BXOR</a>.
            </td>
          </tr>
        </table>
      </subsection>

      <subsection name="Examples">
        <p>
          To configure the check:
        </p>
        <source>
&lt;module name=&quot;BooleanExpressionComplexity&quot;/&gt;
        </source>

        <p>
          To configure the check with 7 allowed operation in boolean
          expression:
        </p>
        <source>
&lt;module name=&quot;BooleanExpressionComplexity&quot;&gt;
    &lt;property name=&quot;max&quot; value=&quot;7&quot;/&gt;
&lt;/module&gt;
        </source>

        <p>
          To configure the check to ignore <code>&#x26;</code> and
          <code>|</code>:
        </p>
        <source>
&lt;module name="BooleanExpressionComplexity"&gt;
    &lt;property name="tokens" value="BXOR,LAND,LOR"/&gt;
&lt;/module&gt;
        </source>

      </subsection>

      <subsection name="Example of Usage">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+BooleanExpressionComplexity">
            Checkstyle Style</a>
          </li>
        </ul>
      </subsection>

      <subsection name="Error Messages">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fmetrics+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22booleanExpressionComplexity%22">
            booleanExpressionComplexity</a>
          </li>
        </ul>
        <p>
          All messages can be customized if the default message doesn't suit you.
          Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
        </p>
      </subsection>

      <subsection name="Package">
        <p>
          com.puppycrawl.tools.checkstyle.checks.metrics
        </p>
      </subsection>

      <subsection name="Parent Module">
        <p>
          <a href="config.html#TreeWalker">TreeWalker</a>
        </p>
      </subsection>
    </section>

    <section name="ClassDataAbstractionCoupling">
      <subsection name="Description">
        <p>
          This metric measures the number of instantiations of other
          classes within the given class. This type of coupling is not
          caused by inheritance or the object oriented
          paradigm. Generally speaking, any data type with other data
          types as members or local variable that is an instantiation
          (object) of another class has data abstraction coupling (DAC).
          The higher the DAC, the more complex the structure of the class.
        </p>
        <p>
          This check processes files in the following way:
          <ol>
            <li>
              Iterates over the list of tokens (defined below) and counts all mentioned classes.
              <ul>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#IMPORT">PACKAGE_DEF</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#IMPORT">IMPORT</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_NEW">LITERAL_NEW</a>
                </li>
              </ul>
            </li>
            <li>
              If a class was imported with direct import (i.e. <code>import java.math.BigDecimal</code>),
              or the class was referenced with the package name (i.e. <code>java.math.BigDecimal value</code>)
              and the package was added to the <code>excludedPackages</code> parameter,
              the class does not increase complexity.
            </li>
            <li>
              If a class name was added to the <code>excludedClasses</code> parameter,
              the class does not increase complexity.
            </li>
          </ol>
        </p>
      </subsection>

      <subsection name="Properties">
        <table>
          <tr>
            <th>name</th>
            <th>description</th>
            <th>type</th>
            <th>default value</th>
          </tr>
          <tr>
            <td>max</td>
            <td>the maximum threshold allowed</td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>7</code></td>
          </tr>
          <tr>
            <td>excludedClasses</td>
            <td>User-configured class names to ignore</td>
            <td><a href="property_types.html#stringSet">String Set</a></td>
            <td>boolean, byte, char, double, float, int,
                long, short, void, Boolean, Byte, Character, Double, Float,
                Integer, Long, Short, Void,
                Object, Class, String, StringBuffer, StringBuilder,
                ArrayIndexOutOfBoundsException, Exception,
                RuntimeException, IllegalArgumentException,
                IllegalStateException, IndexOutOfBoundsException,
                NullPointerException, Throwable, SecurityException,
                UnsupportedOperationException,
                List, ArrayList, Deque, Queue, LinkedList,
                Set, HashSet, SortedSet, TreeSet,
                Map, HashMap, SortedMap, TreeMap</td>
          </tr>
          <tr>
            <td>excludeClassesRegexps</td>
            <td>User-configured regular expressions to ignore classes</td>
            <td><a href="property_types.html#stringSet">String Set</a></td>
            <td><code>"^$"</code></td>
          </tr>
          <tr>
            <td>excludedPackages</td>
            <td>User-configured packages to ignore</td>
            <td><a href="property_types.html#stringSet">String Set</a></td>
            <td>{}</td>
          </tr>
        </table>
      </subsection>

      <subsection name="Examples">
        <p>
          To configure the check:
        </p>
        <source>
&lt;module name=&quot;ClassDataAbstractionCoupling&quot;/&gt;
        </source>

        <p>
          To configure the check with a threshold of 5:
        </p>
        <source>
&lt;module name=&quot;ClassDataAbstractionCoupling&quot;&gt;
    &lt;property name=&quot;max&quot; value=&quot;5&quot;/&gt;
&lt;/module&gt;
        </source>

        <p>
          To configure the check with two excluded classes <code>HashMap</code> and <code>HashSet</code>:
        </p>
        <source>
          &lt;module name=&quot;ClassDataAbstractionCoupling&quot;&gt;
          &lt;property name=&quot;excludedClasses&quot; value=&quot;HashMap, HashSet&quot;/&gt;
          &lt;/module&gt;
        </source>

        <p>
          To configure the check with two regular expressions <code>^Array.*</code> and <code>.*Exception$</code>:
        </p>
        <source>
          &lt;module name=&quot;ClassDataAbstractionCoupling&quot;&gt;
          &lt;property name=&quot;excludeClassesRegexps&quot; value=&quot;^Array.*, .*Exception$&quot;/&gt;
          &lt;/module&gt;
        </source>

        <p>
          The following example demonstrates usage of <b>excludedClasses</b> and <b>excludeClassesRegexps</b> properties
        </p>
        <p>
          Expected result is one class <code>Date</code>
        </p>
        <source>
          &lt;module name=&quot;ClassDataAbstractionCoupling&quot;&gt;
          &lt;property name=&quot;excludedClasses&quot; value=&quot;ArrayList&quot;/&gt;
          &lt;property name=&quot;excludeClassesRegexps&quot; value=&quot;^Hash.*&quot;/&gt;
          &lt;/module&gt;
        </source>
        <source>
          public class InputClassCoupling {
          public Set _set = new HashSet();
          public Map _map = new HashMap();
          public List&lt;String&gt; _list = new ArrayList&lt;&gt;();
          public Date _date = new Date();
          }
        </source>

        <p>
          To configure the check with two excluded classes <code>HashMap</code> and <code>HashSet</code>:
        </p>
        <source>
&lt;module name=&quot;ClassDataAbstractionCoupling&quot;&gt;
    &lt;property name=&quot;excludedClasses&quot; value=&quot;HashMap, HashSet&quot;/&gt;
&lt;/module&gt;
        </source>

        <p>
          To configure the check with two regular expressions <code>^Array.*</code> and <code>.*Exception$</code>:
        </p>
        <source>
&lt;module name=&quot;ClassDataAbstractionCoupling&quot;&gt;
    &lt;property name=&quot;excludeClassesRegexps&quot; value=&quot;^Array.*, .*Exception$&quot;/&gt;
&lt;/module&gt;
        </source>

        <p>
          The following example demonstrates usage of <b>excludedClasses</b> and <b>excludeClassesRegexps</b> properties
        </p>
        <p>
          Expected result is one class <code>Date</code>
        </p>
        <source>
&lt;module name=&quot;ClassDataAbstractionCoupling&quot;&gt;
    &lt;property name=&quot;excludedClasses&quot; value=&quot;ArrayList&quot;/&gt;
    &lt;property name=&quot;excludeClassesRegexps&quot; value=&quot;^Hash.*&quot;/&gt;
&lt;/module&gt;
        </source>
        <source>
public class InputClassCoupling {
    public Set _set = new HashSet();
    public Map _map = new HashMap();
    public List&lt;String&gt; _list = new ArrayList&lt;&gt;();
    public Date _date = new Date();
}
        </source>

        <p>
          Override property <code>excludedPackages</code> to mark some packages as excluded.
          Each member of <code>excludedPackages</code> should be a valid identifier:
          <ul>
            <li>
              <code>java.util</code> - valid, excludes all classes inside <code>java.util</code>,
              but not from the subpackages.
            </li>
            <li>
              <code>java.util.</code> - invalid, should not end with a dot.
            </li>
            <li>
              <code>java.util.*</code> - invalid, should not end with a star.
            </li>
          </ul>
        </p>
        <p>
          Note, that checkstyle will ignore all classes from the <code>java.lang</code> package and its subpackages,
          even if the <code>java.lang</code> was not listed in the <code>excludedPackages</code> parameter.
        </p>
        <p>
          Also node, that <code>excludedPackages</code> will not exclude classes, imported via wildcard
          (e.g. <code>import java.math.*</code>). Instead of wildcard import you should use direct import
          (e.g. <code>import java.math.BigDecimal</code>).
        </p>
        <p>
          Also note, that checkstyle will not exlude classes within the same file
          even if it was listed in the <code>excludedPackages</code> parameter. For example, assuming the config is

          <source>
&lt;module name=&quot;ClassDataAbstractionCoupling&quot;&gt;
    &lt;property name=&quot;excludedPackages&quot; value=&quot;a.b&quot;/&gt;
&lt;/module&gt;
          </source>

          And the file <code>a.b.Foo.java</code> is:

          <source>
package a.b;

import a.b.Bar;
import a.b.c.Baz;

public class Foo {
    public Bar bar; // Will be ignored, located inside ignored a.b package
    public Baz baz; // Will not be ignored, located inside a.b.c package
    public Data data; // Will not be ignored, same file

    class Data {
        public Foo foo; // Will not be ignored, same file
    }
}
          </source>

          The <code>bar</code> member will not be counted,
          since the <code>a.b</code> added to the <code>excludedPackages</code>.
          The <code>baz</code> member will be counted,
          since the <code>a.b.c</code> was not added to the <code>excludedPackages</code>.
          The <code>data</code> and <code>foo</code> members will be counted, as they are inside same file.
        </p>
        <p>
          Example of usage:
        </p>
        <source>
&lt;module name=&quot;ClassDataAbstractionCoupling&quot;&gt;
    &lt;property name=&quot;excludedPackages&quot; value=&quot;java.util, java.math&quot;/&gt;
&lt;/module&gt;
        </source>
      </subsection>

      <subsection name="Example of Usage">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ClassDataAbstractionCoupling">
            Checkstyle Style</a>
          </li>
        </ul>
      </subsection>

      <subsection name="Error Messages">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fmetrics+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22classDataAbstractionCoupling%22">
            classDataAbstractionCoupling</a>
          </li>
        </ul>
        <p>
          All messages can be customized if the default message doesn't suit you.
          Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
        </p>
      </subsection>

      <subsection name="Package">
        <p>
          com.puppycrawl.tools.checkstyle.checks.metrics
        </p>
      </subsection>

      <subsection name="Parent Module">
        <p>
          <a href="config.html#TreeWalker">TreeWalker</a>
        </p>
      </subsection>
    </section>

    <section name="ClassFanOutComplexity">
      <subsection name="Description">
        <p>
          The number of other classes a given class relies on. Also the
          square of this has been shown to indicate the amount of
          maintenance required in functional programs (on a file basis)
          at least.
        </p>
        <p>
          This check processes files in the following way:
          <ol>
            <li>
              Iterates over the list of tokens (defined below) and counts all mentioned classes.
              <ul>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PACKAGE_DEF">PACKAGE_DEF</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#IMPORT">IMPORT</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#TYPE">TYPE</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_NEW">LITERAL_NEW</a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_THROWS">
                    LITERAL_THROWS
                  </a>
                </li>
                <li>
                  <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">
                    ANNOTATION_DEF
                  </a>
                </li>
              </ul>
            </li>
            <li>
              If a class was imported with direct import (i.e. <code>import java.math.BigDecimal</code>),
              or the class was referenced with the package name (i.e. <code>java.math.BigDecimal value</code>)
              and the package was added to the <code>excludedPackages</code> parameter,
              the class does not increase complexity.
            </li>
            <li>
              If a class name was added to the <code>excludedClasses</code> parameter,
              the class does not increase complexity.
            </li>
          </ol>
        </p>
      </subsection>

      <subsection name="Properties">
        <table>
          <tr>
            <th>name</th>
            <th>description</th>
            <th>type</th>
            <th>default value</th>
          </tr>
          <tr>
            <td>max</td>
            <td>the maximum threshold allowed</td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>20</code></td>
          </tr>
          <tr>
            <td>excludedClasses</td>
            <td>User-configured class names to ignore</td>
            <td><a href="property_types.html#stringSet">String Set</a></td>
            <td>boolean, byte, char, double, float, int,
                long, short, void, Boolean, Byte, Character, Double, Float,
                Integer, Long, Short, Void,
                Object, Class, String, StringBuffer, StringBuilder,
                ArrayIndexOutOfBoundsException, Exception,
                RuntimeException, IllegalArgumentException,
                IllegalStateException, IndexOutOfBoundsException,
                NullPointerException, Throwable, SecurityException,
                UnsupportedOperationException,
                List, ArrayList, Deque, Queue, LinkedList,
                Set, HashSet, SortedSet, TreeSet,
                Map, HashMap, SortedMap, TreeMap</td>
          </tr>
          <tr>
            <td>excludeClassesRegexps</td>
            <td>User-configured regular expressions to ignore classes</td>
            <td><a href="property_types.html#stringSet">String Set</a></td>
            <td><code>"^$"</code></td>
          </tr>
          <tr>
            <td>excludedPackages</td>
            <td>User-configured packages to ignore</td>
            <td><a href="property_types.html#stringSet">String Set</a></td>
            <td>{}</td>
          </tr>
        </table>
      </subsection>

      <subsection name="Examples">
        <p>
          To configure the check:
        </p>
        <source>
&lt;module name=&quot;ClassFanOutComplexity&quot;/&gt;
        </source>

        <p>
          To configure the check with a threshold of 10:
        </p>
        <source>
&lt;module name=&quot;ClassFanOutComplexity&quot;&gt;
    &lt;property name=&quot;max&quot; value=&quot;10&quot;/&gt;
&lt;/module&gt;
        </source>

        <p>
          Override property <code>excludedPackages</code> to mark some packages as excluded.
          Each member of <code>excludedPackages</code> should be a valid identifier:
          <ul>
            <li>
              <code>java.util</code> - valid, excludes all classes inside <code>java.util</code>,
              but not from the subpackages.
            </li>
            <li>
              <code>java.util.</code> - invalid, should not end with a dot.
            </li>
            <li>
              <code>java.util.*</code> - invalid, should not end with a star.
            </li>
          </ul>
        </p>
        <p>
          Note, that checkstyle will ignore all classes from the <code>java.lang</code> package and its subpackages,
          even if the <code>java.lang</code> was not listed in the <code>excludedPackages</code> parameter.
        </p>
        <p>
          Also node, that <code>excludedPackages</code> will not exclude classes, imported via wildcard
          (e.g. <code>import java.math.*</code>). Instead of wildcard import you should use direct import
          (e.g. <code>import java.math.BigDecimal</code>).
        </p>
        <p>
          Also note, that checkstyle will not exlude classes within the same file
          even if it was listed in the <code>excludedPackages</code> parameter. For example, assuming the config is

          <source>
&lt;module name=&quot;ClassDataAbstractionCoupling&quot;&gt;
    &lt;property name=&quot;excludedPackages&quot; value=&quot;a.b&quot;/&gt;
&lt;/module&gt;
          </source>

          And the file <code>a.b.Foo.java</code> is:

          <source>
package a.b;

import a.b.Bar;
import a.b.c.Baz;

public class Foo {
    public Bar bar; // Will be ignored, located inside ignored a.b package
    public Baz baz; // Will not be ignored, located inside a.b.c package
    public Data data; // Will not be ignored, same file

    class Data {
        public Foo foo; // Will not be ignored, same file
    }
}
          </source>

          The <code>bar</code> member will not be counted,
          since the <code>a.b</code> added to the <code>excludedPackages</code>.
          The <code>baz</code> member will be counted,
          since the <code>a.b.c</code> was not added to the <code>excludedPackages</code>.
          The <code>data</code> and <code>foo</code> members will be counted, as they are inside same file.
        </p>
        <p>
          Example of usage:
        </p>
        <source>
&lt;module name=&quot;ClassFanOutComplexity&quot;&gt;
    &lt;property name=&quot;excludedPackages&quot; value=&quot;java.util, java.math&quot;/&gt;
&lt;/module&gt;
        </source>
      </subsection>

      <subsection name="Example of Usage">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ClassFanOutComplexity">
            Checkstyle Style</a>
          </li>
        </ul>
      </subsection>

      <subsection name="Error Messages">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fmetrics+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22classFanOutComplexity%22">
            classFanOutComplexity</a>
          </li>
        </ul>
        <p>
          All messages can be customized if the default message doesn't suit you.
          Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
        </p>
      </subsection>

      <subsection name="Package">
        <p>
          com.puppycrawl.tools.checkstyle.checks.metrics
        </p>
      </subsection>

      <subsection name="Parent Module">
        <p>
          <a href="config.html#TreeWalker">TreeWalker</a>
        </p>
      </subsection>
    </section>

    <section name="CyclomaticComplexity">
      <subsection name="Description">
        <p>
          Checks cyclomatic complexity against a specified limit.
            It is a measure of the minimum number of
            possible paths through the source and therefore the number of
            required tests, it is not a about quality of code!
          It is only applied to methods, c-tors,
          <a href="https://docs.oracle.com/javase/tutorial/java/javaOO/initial.html">static initializers and instance initializers</a>.
          <br/>
          The complexity is equal to the number of decision points <code> + 1</code>
          Decision points: <code>if</code>, <code>while</code>
          , <code>do</code>, <code>for</code>, <code>?:</code>, <code>catch</code>
          , <code>switch</code>, <code>case</code>
          statements, and operators <code>&#x26;&#x26;</code> and <code>||</code>
          in the body of target.

          <br/>By pure theory level 1-4 is considered easy to test, 5-7 OK, 8-10
          consider re-factoring to ease testing, and 11+ re-factor now as testing will be painful.

            <br/>When it comes to code quality measurement by this metric
            level 10 is very good level as a ultimate target (that is hard to archive).
            Do not be ashamed to have complexity level 15 or even higher,
            but keep it below 20 to catch really bad designed code automatically.
            <br/>Please use Suppression to avoid violations on cases that could not be split in few
            methods without damaging readability of code or encapsulation.
            <br/>
        </p>
      </subsection>

      <subsection name="Properties">
        <table>
          <tr>
            <th>name</th>
            <th>description</th>
            <th>type</th>
            <th>default value</th>
          </tr>
          <tr>
            <td>max</td>
            <td>the maximum threshold allowed</td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>10</code></td>
          </tr>
          <tr>
            <td>switchBlockAsSingleDecisionPoint</td>
            <td>whether to treat the whole switch block as a single decision point</td>
            <td><a href="property_types.html#boolean">Boolean</a></td>
            <td><code>false</code></td>
          </tr>

          <tr>
            <td>tokens</td>
            <td>tokens to check</td>

            <td>
              subset of tokens
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_WHILE">LITERAL_WHILE</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_DO">LITERAL_DO</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_FOR">LITERAL_FOR</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_IF">LITERAL_IF</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_SWITCH">LITERAL_SWITCH</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_CASE">LITERAL_CASE</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_CATCH">LITERAL_CATCH</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#QUESTION">QUESTION</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LAND">LAND</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LOR">LOR</a>.
            </td>

            <td>
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_WHILE">LITERAL_WHILE</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_DO">LITERAL_DO</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_FOR">LITERAL_FOR</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_IF">LITERAL_IF</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_SWITCH">LITERAL_SWITCH</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_CASE">LITERAL_CASE</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_CATCH">LITERAL_CATCH</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#QUESTION">QUESTION</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LAND">LAND</a>,
              <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LOR">LOR</a>.
            </td>
          </tr>
        </table>
      </subsection>

      <subsection name="Examples">
        <p>
          To configure the check:
        </p>
        <source>
&lt;module name=&quot;CyclomaticComplexity&quot;/&gt;
        </source>

        <p>
          To configure the check with a threshold of 15:
        </p>
        <source>
&lt;module name=&quot;CyclomaticComplexity&quot;&gt;
    &lt;property name=&quot;max&quot; value=&quot;15&quot;/&gt;
&lt;/module&gt;
        </source>
        <p>
          Explanation on how complexity is calculated (switchBlockAsSingleDecisionPoint is set to false):
        </p>
        <source>
class CC {
   // Cyclomatic Complexity = 12
   public void doSmth()  {               // 1
       if (a == b)  {                    // 2
            if (a1 == b1                 // 3
                &amp;&amp; c1 == d1) {   // 4
               fiddle();
            }
            else if (a2 == b2            // 5
                      || c1 &lt; d1) {   // 6
                fiddle();
            }
            else {
                fiddle();
            }
       }
        else if (c == d) {               // 7
            while (c == d) {             // 8
                fiddle();
            }
        }
         else if (e == f) {
            for (n = 0; n &lt; h         // 9
                    || n &lt; 6; n++) {  // 10
                fiddle();
            }
        }
        else {
            switch (z) {
              case 1:                    // 11
                    fiddle();
                    break;
              case 2:                    // 12
                    fiddle();
                    break;
              default:
                    fiddle();
                    break;
            }
        }
    }
}        </source>
        <p>
          Explanation on how complexity is calculated (switchBlockAsSingleDecisionPoint is set to true):
        </p>
        <source>
class SwitchExample {
   // Cyclomatic Complexity = 2
   public void doSmth()  {            // 1
       int z = 1;
       switch (z) {                   // 2
           case 1:
               foo1();
               break;
           case 2:
               foo2();
               break;
           default:
               fooDefault();
               break;
       }
   }
}        </source>
      </subsection>

      <subsection name="Example of Usage">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+CyclomaticComplexity">
            Checkstyle Style</a>
          </li>
        </ul>
      </subsection>

      <subsection name="Error Messages">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fmetrics+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22cyclomaticComplexity%22">
            cyclomaticComplexity</a>
          </li>
        </ul>
        <p>
          All messages can be customized if the default message doesn't suit you.
          Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
        </p>
      </subsection>

      <subsection name="Package">
        <p>
          com.puppycrawl.tools.checkstyle.checks.metrics
        </p>
      </subsection>

      <subsection name="Parent Module">
        <p>
          <a href="config.html#TreeWalker">TreeWalker</a>
        </p>
      </subsection>
    </section>

    <section name="JavaNCSS">
      <subsection name="Description">
        <p>
          Determines complexity of methods, classes and files by
          counting the Non Commenting Source Statements (NCSS).  This
          check adheres to the <a
          href="http://www.kclee.de/clemens/java/javancss/#specification">
          specification</a> for the
          <a href="http://www.kclee.de/clemens/java/javancss/">JavaNCSS-Tool</a>
          written by <b>Chr. Clemens Lee</b>.<br/>
          Roughly said the NCSS metric is calculated by
          counting the source lines which are not comments, (nearly)
          equivalent to counting the semicolons and opening curly
          braces.<br/> The NCSS for a class is summarized from the NCSS
          of all its methods, the NCSS of its nested classes and the
          number of member variable declarations.<br/> The NCSS for a
          file is summarized from the ncss of all its top level classes,
          the number of imports and the package declaration.
        </p>

        <p>
          Rationale: Too large methods and classes are hard to read and
          costly to maintain. A large NCSS number often means that a
          method or class has too many responsibilities and/or
          functionalities which should be decomposed into smaller units.
        </p>
      </subsection>

      <subsection name="Properties">
        <table>
          <tr>
            <th>name</th>
            <th>description</th>
            <th>type</th>
            <th>default value</th>
          </tr>
          <tr>
            <td>methodMaximum</td>
            <td>
              the maximum allowed number of non commenting lines in a
              method.
            </td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>50</code></td>
          </tr>
          <tr>
            <td>classMaximum</td>
            <td>
              the maximum allowed number of non commenting lines in a
              class.
            </td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>1500</code></td>
          </tr>
          <tr>
            <td>fileMaximum</td>
            <td>
              the maximum allowed number of non commenting lines in a
              file including all top level and nested classes.
            </td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>2000</code></td>
          </tr>
        </table>
      </subsection>

      <subsection name="Examples">
        <p>
          To configure the check:
        </p>
        <source>
&lt;module name=&quot;JavaNCSS&quot;/&gt;
        </source>

        <p>
          To configure the check with 40 allowed non commenting lines
          for a method:
        </p>
        <source>
&lt;module name=&quot;JavaNCSS&quot;&gt;
    &lt;property name=&quot;methodMaximum&quot; value=&quot;40&quot;/&gt;
&lt;/module&gt;
        </source>
      </subsection>

      <subsection name="Example of Usage">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+JavaNCSS">
            Checkstyle Style</a>
          </li>
        </ul>
      </subsection>

      <subsection name="Error Messages">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fmetrics+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22ncss.class%22">
            ncss.class</a>
          </li>
          <li>
            <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fmetrics+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22ncss.file%22">
            ncss.file</a>
          </li>
          <li>
            <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fmetrics+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22ncss.method%22">
            ncss.method</a>
          </li>
        </ul>
        <p>
          All messages can be customized if the default message doesn't suit you.
          Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
        </p>
      </subsection>

      <subsection name="Package">
        <p>
          com.puppycrawl.tools.checkstyle.checks.metrics
        </p>
      </subsection>

      <subsection name="Parent Module">
        <p>
          <a href="config.html#TreeWalker">TreeWalker</a>
        </p>
      </subsection>
    </section>

    <section name="NPathComplexity">
      <subsection name="Description">
        <p>
          The NPATH metric computes the number of possible execution
          paths through a function(method). It takes into account the nesting of
          conditional statements and multi-part boolean expressions
          (e.g., A &amp;&amp; B, C || D, etc.).
          <br/>
          The NPATH metric was designed base on Cyclomatic complexity to
          avoid problem of Cyclomatic complexity metric like nesting level within a function(method).
        </p>
        <p>
          Metric was described at <a href="http://dl.acm.org/citation.cfm?id=42379">"NPATH: a measure of execution pathcomplexity and its applications"</a>. If you need detailed description of algorithm, please read that article,
          it is well written and have number of examples and details.
        </p>

        <p>Here is some quotes:</p>

        <blockquote>An NPATH threshold value of 200 has been established
          for a function. The value 200 is based on studies done
          at AT&amp;T Bell Laboratories [1988 year].
        </blockquote>

        <blockquote>
        Some of the most effective methods of reducing the NPATH value include<br/>
        - distributing functionality,<br/>
        - implementing multiple if statements as a switch statement<br/>
        - creating a separate function for logical expressions with a high count of and (&amp;&amp;) and or (||) operators.
        </blockquote>

        <blockquote>
        Although strategies to reduce the NPATH complexity
        of functions are important, care must be taken not to
        distort the logical clarity of the software by applying a
        strategy to reduce the complexity of functions. That is,
        there is a point of diminishing return beyond which a
        further attempt at reduction of complexity distorts the
        logical clarity of the system structure.
        </blockquote>

        <table>
        <thead><tr><th>Structure</th><th> Complexity expression </th></tr></thead>
        <tr><td>if ([expr]) { [if-range] }</td><td>NP(if-range) + 1 + NP(expr)</td></tr>
        <tr><td>if ([expr]) { [if-range] } else { [else-range] }</td><td>NP(if-range) + NP(else-range) + NP(expr)</td></tr>
        <tr><td>while ([expr]) { [while-range] } </td><td>NP(while-range) + NP(expr) + 1</td></tr>
        <tr><td>do { [do-range] } while ([expr])</td><td>NP(do-range) + NP(expr) + 1</td></tr>
        <tr><td>for([expr1]; [expr2]; [expr3]) { [for-range] }</td><td>NP(for-range) + NP(expr1) + NP(expr2) + NP(expr3) + 1</td></tr>
        <tr><td>switch ([expr]) { case : [case-range] default: [default-range] }</td><td>S(i=1:i=n)NP(case-range[i]) + NP(default-range) + NP(expr)</td></tr>
        <tr><td>[expr1] ? [expr2] : [expr3]</td><td>NP(expr1) + NP(expr2) + NP(expr3) + 2</td></tr>
        <tr><td>goto label</td><td>1</td></tr>
        <tr><td>break</td><td>1</td></tr>
        <tr><td>Expressions</td><td>Number of &amp;&amp; and || operators in expression. No operators - 0</td></tr>
        <tr><td>continue</td><td>1</td></tr>
        <tr><td>return</td><td>1</td></tr>
        <tr><td>Statement (even sequential statements)</td><td>1</td></tr>
        <tr><td>Empty block {}</td><td>1</td></tr>
        <tr><td>Function call</td><td>1</td></tr>
        <tr><td>Function(Method) declaration or Block</td><td>P(i=1:i=N)NP(Statement[i])</td></tr>
        </table>

        <p>
          <b>Rationale:</b> Nejmeh says that his group had an informal NPATH
          limit of 200 on individual routines; functions(methods) that exceeded
          this value were candidates for further decomposition - or at
          least a closer look.
          <b>Please do not be fanatic with limit 200</b>
          - choose number that suites your project style. Limit 200 is
          empirical number base on some sources of at AT&amp;T Bell Laboratories
          of 1988 year.
        </p>
      </subsection>

      <subsection name="Properties">
        <table>
          <tr>
            <th>name</th>
            <th>description</th>
            <th>type</th>
            <th>default value</th>
          </tr>
          <tr>
            <td>max</td>
            <td>the maximum threshold allowed</td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>200</code></td>
          </tr>
        </table>
      </subsection>

      <subsection name="Examples">
        <p>
          To configure the check:
        </p>
        <source>
&lt;module name=&quot;NPathComplexity&quot;/&gt;
        </source>

        <p>
          To configure the check with a threshold of 1000:
        </p>
        <source>
&lt;module name=&quot;NPathComplexity&quot;&gt;
    &lt;property name=&quot;max&quot; value=&quot;1000&quot;/&gt;
&lt;/module&gt;
        </source>
      </subsection>

      <subsection name="Example of Usage">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+NPathComplexity">
            Checkstyle Style</a>
          </li>
        </ul>
      </subsection>

      <subsection name="Error Messages">
        <ul>
          <li>
            <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fmetrics+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22npathComplexity%22">
            npathComplexity</a>
          </li>
        </ul>
        <p>
          All messages can be customized if the default message doesn't suit you.
          Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
        </p>
      </subsection>

      <subsection name="Package">
        <p>
          com.puppycrawl.tools.checkstyle.checks.metrics
        </p>
      </subsection>

      <subsection name="Parent Module">
        <p>
          <a href="config.html#TreeWalker">TreeWalker</a>
        </p>
      </subsection>
    </section>
  </body>
</document>