Project

General

Profile

Bug #57 » checkstyle.xml

Frédéric Barthéléry, 03/24/2009 05:48 PM

 
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
  Checkstyle configuration that checks the sun coding conventions from:
9

    
10
  - the Java Language Specification at
11
  http://java.sun.com/docs/books/jls/second_edition/html/index.html
12

    
13
  - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
14

    
15
  - the Javadoc guidelines at
16
  http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
17

    
18
  - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
19

    
20
  - some best practices
21

    
22
  Checkstyle is very configurable. Be sure to read the documentation at
23
  http://checkstyle.sf.net (or in your downloaded distribution).
24

    
25
  Most Checks are configurable, be sure to consult the documentation.
26

    
27
  To completely disable a check, just comment it out or delete it from the file.
28

    
29
  Finally, it is worth reading the documentation.
30

    
31
-->
32

    
33
<module name="Checker">
34

    
35
    <!-- Checks that a package.html file exists for each package.     -->
36
    <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
37
    <module name="PackageHtml"/>
38

    
39
    <!-- Checks whether files end with a new line.                        -->
40
    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
41
    <module name="NewlineAtEndOfFile"/>
42

    
43
    <!-- Checks that property files contain the same keys.         -->
44
    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
45
    <module name="Translation"/>
46

    
47

    
48
    <module name="TreeWalker">
49

    
50
	<!-- Checks for Javadoc comments.                     -->
51
	<!-- See http://checkstyle.sf.net/config_javadoc.html -->
52
	<module name="JavadocMethod">
53
	    <property name="allowUndeclaredRTE" value="true"/>
54
	</module>
55
	<module name="JavadocType"/>
56
	<module name="JavadocVariable">
57
	    <property name="scope" value="package" />
58
	</module>
59
	<module name="JavadocStyle">
60
	    <property name="checkEmptyJavadoc" value="true"/>
61
	</module>
62

    
63

    
64
	<!-- Checks for Naming Conventions.                  -->
65
	<!-- See http://checkstyle.sf.net/config_naming.html -->
66
	<module name="ConstantName"/>
67
	<module name="LocalFinalVariableName"/>
68
	<module name="LocalVariableName"/>
69
	<module name="MemberName">
70
	    <property  name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
71
	</module>
72
	<module name="MethodName"/>
73
	<module name="PackageName"/>
74
	<module name="ParameterName"/>
75
	<module name="StaticVariableName"/>
76
	<module name="TypeName"/>
77

    
78

    
79
	<!-- Checks for Headers                                -->
80
	<!-- See http://checkstyle.sf.net/config_header.html   -->
81
	<!-- <module name="Header">                            -->
82
	<!-- The follow property value demonstrates the ability     -->
83
	<!-- to have access to ANT properties. In this case it uses -->
84
	<!-- the ${basedir} property to allow Checkstyle to be run  -->
85
	<!-- from any directory within a project. See property      -->
86
	<!-- expansion,                                             -->
87
	<!-- http://checkstyle.sf.net/config.html#properties        -->
88
	<!-- <property                                              -->
89
	<!--     name="headerFile"                                  -->
90
	<!--     value="${basedir}/java.header"/>                   -->
91
	<!-- </module> -->
92

    
93
	<!-- Following interprets the header file as regular expressions. -->
94
	<!-- <module name="RegexpHeader"/>                                -->
95

    
96

    
97
	<!-- Checks for imports                              -->
98
	<!-- See http://checkstyle.sf.net/config_import.html -->
99
	<module name="AvoidStarImport"/>
100
	<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
101
	<module name="RedundantImport"/>
102
	<module name="UnusedImports"/>
103

    
104

    
105
	<!-- Checks for Size Violations.                    -->
106
	<!-- See http://checkstyle.sf.net/config_sizes.html -->
107
	<module name="FileLength"/>
108
	<module name="LineLength">
109
	    <property name="max" value="120" />
110
	</module>
111
	<module name="MethodLength"/>
112
	<module name="ParameterNumber"/>
113
	<module name="AnonInnerLength">
114
	    <property name="max" value="60" />
115
	</module>
116

    
117

    
118
	<!-- Checks for whitespace                               -->
119
	<!-- See http://checkstyle.sf.net/config_whitespace.html -->
120
	<module name="EmptyForIteratorPad"/>
121
	<module name="MethodParamPad"/>
122
	<module name="NoWhitespaceAfter"/>
123
	<module name="NoWhitespaceBefore"/>
124
	<module name="OperatorWrap"/>
125
	<module name="ParenPad"/>
126
	<module name="TypecastParenPad"/>
127
	<!-- We want mixed tabulation
128
	  <module name="TabCharacter"/> 
129
	  -->
130
	<module name="WhitespaceAfter"/>
131
	<module name="WhitespaceAround"/>
132

    
133

    
134
	<!-- Modifier Checks                                    -->
135
	<!-- See http://checkstyle.sf.net/config_modifiers.html -->
136
	<module name="ModifierOrder"/>
137
	<module name="RedundantModifier"/>
138

    
139

    
140
	<!-- Checks for blocks. You know, those {}'s         -->
141
	<!-- See http://checkstyle.sf.net/config_blocks.html -->
142
	<module name="AvoidNestedBlocks"/>
143
	<module name="EmptyBlock"/>
144
	<module name="LeftCurly"/>
145
	<!--
146
	  <module name="NeedBraces"/>
147
	  -->
148
	<module name="RightCurly"/>
149

    
150

    
151
	<!-- Checks for common coding problems               -->
152
	<!-- See http://checkstyle.sf.net/config_coding.html -->
153
	<module name="CovariantEquals"/>
154
	<module name="AvoidInlineConditionals"/>
155
	<module name="InnerAssignment" />
156
	<module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
157
	<module name="EmptyStatement"/>
158
	<module name="EqualsHashCode"/>
159
	<module name="HiddenField">
160
	    <property name="ignoreConstructorParameter" value="true"/>
161
	    <property name="ignoreAbstractMethods" value="true"/>
162
	    <property name="ignoreSetter" value="true"/>
163
	</module>
164
	<module name="IllegalInstantiation"/>
165
	<module name="InnerAssignment"/>
166
	<!--
167
	  <module name="MagicNumber"/>
168
	  -->
169
	<module name="MissingSwitchDefault"/>
170
	<module name="RedundantThrows"/>
171
	<module name="SimplifyBooleanExpression"/>
172
	<module name="SimplifyBooleanReturn"/>
173
	<module name="StringLiteralEquality"/>
174
	<module name="SuperFinalize"/>
175
	<module name="IllegalCatch"/>
176
	<module name="IllegalThrows"/>
177
	<module name="PackageDeclaration"/>
178
	<module name="JUnitTestCase"/>
179
	<module name="DeclarationOrder"/>
180
	<module name="ExplicitInitialization"/>
181
	<module name="DefaultComesLast"/>
182
	<module name="MissingCtor"/>
183
	<module name="FallThrough"/>
184
	<module name="MultipleStringLiterals"/>
185
	<module name="MultipleVariableDeclarations"/>
186
	<module name="UnnecessaryParentheses"/>
187
	<module name="ParameterAssignment"/>
188
	<module name="SuperClone"/>
189

    
190
	<!-- Checks for class design                         -->
191
	<!-- See http://checkstyle.sf.net/config_design.html -->
192
	<module name="DesignForExtension"/>
193
	<module name="FinalClass"/>
194
	<module name="HideUtilityClassConstructor"/>
195
	<module name="InterfaceIsType"/>
196
	<module name="VisibilityModifier"/>
197
	<module name="MutableException"/>
198

    
199

    
200
	<!-- Miscellaneous other checks.                   -->
201
	<!-- See http://checkstyle.sf.net/config_misc.html -->
202
	<module name="ArrayTypeStyle"/>
203
	<module name="FinalParameters">
204
	    <property name="tokens" value="CTOR_DEF"/>
205
	</module>
206
	<module name="Indentation"/>
207

    
208
	<module name="GenericIllegalRegexp">
209
	    <property name="format" value="\s+$"/>
210
	    <property name="message" value="Line has trailing spaces."/>
211
	</module>
212
	<module name="TodoComment"/>
213
	<module name="UpperEll"/>
214

    
215
	<module name="BooleanExpressionComplexity"/>
216
	<module name="UpperEll"/>
217

    
218

    
219
	<module name="ArrayTypeStyle"/>
220

    
221
    </module>
222
    <module name="StrictDuplicateCode"/>
223
    <module name="NewlineAtEndOfFile"/>
224

    
225
</module>
    (1-1/1)