1 <?xml version="1.0"?>
\r
2 <!DOCTYPE module PUBLIC
\r
3 "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
\r
4 "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
\r
8 Checkstyle configuration that checks the sun coding conventions from:
\r
10 - the Java Language Specification at
\r
11 http://java.sun.com/docs/books/jls/second_edition/html/index.html
\r
13 - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
\r
15 - the Javadoc guidelines at
\r
16 http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
\r
18 - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
\r
20 - some best practices
\r
22 Checkstyle is very configurable. Be sure to read the documentation at
\r
23 http://checkstyle.sf.net (or in your downloaded distribution).
\r
25 Most Checks are configurable, be sure to consult the documentation.
\r
27 To completely disable a check, just comment it out or delete it from the file.
\r
29 Finally, it is worth reading the documentation.
\r
33 <module name="Checker">
\r
35 <!-- Checks that a package.html file exists for each package. -->
\r
36 <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
\r
37 <!-- module name="PackageHtml"/ -->
\r
39 <!-- Checks whether files end with a new line. -->
\r
40 <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
\r
41 <module name="NewlineAtEndOfFile"/>
\r
43 <!-- Checks that property files contain the same keys. -->
\r
44 <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
\r
45 <module name="Translation"/>
\r
48 <module name="TreeWalker">
\r
50 <!-- Checks for Javadoc comments. -->
\r
51 <!-- See http://checkstyle.sf.net/config_javadoc.html -->
\r
52 <!-- module name="JavadocMethod"/ -->
\r
53 <!-- module name="JavadocType"/ -->
\r
54 <!-- module name="JavadocVariable"/ -->
\r
55 <!-- module name="JavadocStyle"/ -->
\r
57 <!-- Checks for Naming Conventions. -->
\r
58 <!-- See http://checkstyle.sf.net/config_naming.html -->
\r
59 <module name="ConstantName"/>
\r
60 <module name="LocalFinalVariableName"/>
\r
61 <module name="LocalVariableName"/>
\r
62 <module name="MemberName">
63 <property name="format" value="_[a-z][a-zA-Z0-9]*$"/>
65 <module name="MethodName" />
\r
66 <module name="PackageName"/>
\r
67 <module name="ParameterName">
68 <property name="format" value="^a[A-Z][a-zA-Z0-9]*$"/>
70 <module name="StaticVariableName">
71 <property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
73 <module name="TypeName"/>
\r
76 <!-- Checks for Headers -->
\r
77 <!-- See http://checkstyle.sf.net/config_header.html -->
\r
78 <!-- <module name="Header"> -->
\r
79 <!-- The follow property value demonstrates the ability -->
\r
80 <!-- to have access to ANT properties. In this case it uses -->
\r
81 <!-- the ${basedir} property to allow Checkstyle to be run -->
\r
82 <!-- from any directory within a project. See property -->
\r
84 <!-- http://checkstyle.sf.net/config.html#properties -->
\r
86 <!-- name="headerFile" -->
\r
87 <!-- value="${basedir}/java.header"/> -->
\r
90 <!-- Following interprets the header file as regular expressions. -->
\r
91 <!-- <module name="RegexpHeader"/> -->
\r
94 <!-- Checks for imports -->
\r
95 <!-- See http://checkstyle.sf.net/config_import.html -->
\r
96 <module name="AvoidStarImport"/>
\r
97 <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
\r
98 <module name="RedundantImport"/>
\r
99 <module name="UnusedImports"/>
\r
102 <!-- Checks for Size Violations. -->
\r
103 <!-- See http://checkstyle.sf.net/config_sizes.html -->
\r
104 <module name="FileLength"/>
\r
105 <module name="LineLength">
106 <property name="max" value="120"/>
108 <module name="MethodLength"/>
\r
109 <module name="ParameterNumber"/>
\r
112 <!-- Checks for whitespace -->
\r
113 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
\r
114 <module name="EmptyForIteratorPad"/>
\r
115 <!-- module name="MethodParamPad"/ -->
\r
116 <!-- module name="NoWhitespaceAfter"/ -->
\r
117 <module name="NoWhitespaceBefore"/>
\r
118 <module name="OperatorWrap"/>
\r
119 <module name="ParenPad"/>
\r
120 <!-- module name="TypecastParenPad"/ -->
\r
121 <module name="TabCharacter"/>
\r
122 <module name="WhitespaceAfter"/>
\r
123 <!-- module name="WhitespaceAround">
124 <property name="tokens" value=" ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR,MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,GENERIC_START,GENERIC_END,TYPE_EXTENSION_AND,WILDCARD_TYPE"/>
128 <!-- Modifier Checks -->
\r
129 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
\r
130 <module name="ModifierOrder"/>
\r
131 <module name="RedundantModifier"/>
\r
134 <!-- Checks for blocks. You know, those {}'s -->
\r
135 <!-- See http://checkstyle.sf.net/config_blocks.html -->
\r
136 <module name="AvoidNestedBlocks">
137 <property name="allowInSwitchCase" value="true"/>
139 <module name="EmptyBlock"/>
\r
140 <module name="LeftCurly"/>
\r
141 <module name="NeedBraces"/>
\r
142 <module name="RightCurly"/>
\r
145 <!-- Checks for common coding problems -->
\r
146 <!-- See http://checkstyle.sf.net/config_coding.html -->
\r
147 <module name="AvoidInlineConditionals"/>
\r
148 <!-- module name="DoubleCheckedLocking"/ -->
\r
149 <module name="EmptyStatement"/>
\r
150 <module name="EqualsHashCode"/>
\r
151 <module name="HiddenField"/>
\r
152 <module name="IllegalInstantiation"/>
\r
153 <module name="InnerAssignment"/>
\r
154 <module name="MagicNumber">
155 <property name="ignoreNumbers" value="-1,0,1,2,3,4"/>
157 <module name="MissingSwitchDefault"/>
\r
158 <module name="RedundantThrows"/>
\r
159 <module name="SimplifyBooleanExpression"/>
\r
160 <module name="SimplifyBooleanReturn"/>
\r
161 <!-- module name="ExplicitInitialization"/ -->
\r
163 <!-- Checks for class design -->
\r
164 <!-- See http://checkstyle.sf.net/config_design.html -->
\r
165 <!-- module name="DesignForExtension"/ -->
\r
166 <module name="FinalClass"/>
\r
167 <module name="HideUtilityClassConstructor"/>
\r
168 <module name="InterfaceIsType"/>
\r
169 <module name="VisibilityModifier"/>
\r
172 <!-- Miscellaneous other checks. -->
\r
173 <!-- See http://checkstyle.sf.net/config_misc.html -->
\r
174 <module name="ArrayTypeStyle"/>
\r
175 <!-- module name="FinalParameters"/ -->
\r
176 <!-- module name="GenericIllegalRegexp">
\r
177 <property name="format" value="\s+$"/>
\r
178 <property name="message" value="Line has trailing spaces."/>
\r
180 <module name="TodoComment"/>
\r
181 <module name="UpperEll"/>
\r