17b5a40adb26f631ad43841ea7ce1f13918c1f71
[utils] / build-tools / src / main / resources / org.wamblee.checkstyle.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE module PUBLIC
3     "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
4     "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
5
6 <!--
7
8   A Checkstyle configuration that checks against the recommendations
9   in Joshua Bloch, Effective Java (highliy recommended read!)
10
11   This file does NOT duplicate the checks for whitespace settings,
12   placement of curly braces, etc.  Only the rules that are explicitly
13   mentioned in the book are enforced.
14
15   Currently the amount of rules that can be automatically checked by
16   Checkstyle is not very large, but adding more checks of this quality
17   is a high priority goal for the development team.
18
19 -->
20
21 <module name="Checker">
22
23   <!-- Item 6 - Avoid finalizers -->
24   <module name="RegexpMultiline">
25     <property name="format"
26       value="((public)|(protected))\s+void\s+finalize\(\s*\)"/>
27   </module>
28   
29   <module name="FileTabCharacter"/>
30   
31   <module name="TreeWalker">
32
33     <!-- Item 4 - Avoid creating duplicate objects -->
34     <module name="IllegalInstantiation">
35       <property name="classes" value="java.lang.Boolean, java.lang.String"/>
36     </module>
37
38     <!-- Item 8 - Always override hashCode when you override equals -->
39     <module name="EqualsHashCode"/>
40
41     <!-- Item 12 - Make all fields private -->
42     <module name="VisibilityModifier"/>
43
44     <!-- Item 15 - Design and document for inheritance or else prohibit it -->
45     <!-- the module actually implements a very strict rule, it would be
46          interesting to know whether Joshua meant what checkstyle implements.
47          We feel this implementation is well suited as a warning,
48          i.e. if you get error messages from this check you should be
49          able to name a good reason to implement your code the way you do it,
50          especially if you are designing a library and not an application. -->
51     <!-- module name="DesignForExtension">
52       <property name="severity" value="warning"/>
53     </module -->
54
55     <!-- Item 17 - Use interfaces only to define types -->
56     <module name="InterfaceIsType"/>
57
58     <!-- Item 25 - Design method signatures carefully -->
59     <!-- Avoid long parameter lists -->
60     <module name="ParameterNumber">
61       <property name="max" value="5"/>
62     </module>
63
64     <!-- Item 26 - Use overloading judiciously -->
65     <!-- rfe #659735 -->
66
67     <!-- Item 27 - Return zero-length array, not nulls -->
68     <!-- no rfe yet -->
69
70     <!-- Item 28 - Write doc comments for everything -->
71     <!-- module name="JavadocType">
72       <property name="scope" value="private"/>
73     </module>
74     <module name="JavadocMethod"> 
75       <property name="scope" value="private"/>
76       <property name="allowUndeclaredRTE" value="true"/>
77     </module>
78     <module name="JavadocVariable">
79       <property name="scope" value="private"/>
80     </module -->
81
82     <!-- Item 29 - Minimize the scope of local variables -->
83     <!-- no rfe yet -->
84
85
86     <!-- Item 38 - Adhere to generally accepted naming conventions -->
87     <module name="PackageName">
88       <!-- no uppercase letters, between 2 and 8 characters -->
89       <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,15})*$"/>
90     </module>
91     <module name="TypeName"/>
92     <module name="ConstantName"/>
93     <module name="LocalFinalVariableName"/>
94     <module name="LocalVariableName"/>
95     <module name="MemberName"/>
96     <module name="MethodName"/>
97     <module name="ParameterName">
98       <property name="format" value="^a[A-Z][a-zA-Z0-9]*$"/>
99     </module>
100     <module name="StaticVariableName">
101       <property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
102     </module>
103
104     <!-- Item 47 - Don't ignore exceptions -->
105     <module name="EmptyBlock">
106       <property name="tokens" value="LITERAL_CATCH"/>
107       <!-- require a comment, change to stmt to require a statement -->
108       <property name="option" value="text"/>
109     </module>
110
111     <!-- Item 50 - Never invoke wait outside a loop -->
112     <!-- rfe #712798 -->
113
114     <!-- Item 57 - Provide a readResolve method when necessary -->
115     <!-- no rfe yet -->
116
117     <!-- code layout -->
118     <module name="LeftCurly">
119       <property name="option" value="eol"/>
120     </module>
121     <module name="RightCurly">
122       <property name="option" value="same"/>
123     </module>
124     <module name="NeedBraces"/>
125     <module name="OperatorWrap">
126       <property name="option" value="eol"/>
127     </module>
128     <module name="NoWhitespaceAfter">
129       <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
130     </module>
131     <module name="NoWhitespaceBefore"/>
132     <module name="ParenPad"/>
133
134   </module>
135
136 </module>