Skip to content

Commit 79f07a8

Browse files
committed
Added checkstyle
1 parent 34cf398 commit 79f07a8

File tree

1 file changed

+228
-0
lines changed

1 file changed

+228
-0
lines changed

checkstyle.xml

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
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+
Checkstyle configuration based on sun_checks.xml with:
8+
- magic number check is disabled
9+
- hidden field is disabled
10+
- JavadocPackage is disabled
11+
- variables naming is "^[a-z][a-z0-9\_]*$"
12+
13+
Checkstyle configuration that checks the sun coding conventions from:
14+
15+
- the Java Language Specification at
16+
http://java.sun.com/docs/books/jls/second_edition/html/index.html
17+
18+
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
19+
20+
- the Javadoc guidelines at
21+
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
22+
23+
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
24+
25+
- some best practices
26+
27+
Checkstyle is very configurable. Be sure to read the documentation at
28+
http://checkstyle.sf.net (or in your downloaded distribution).
29+
30+
Most Checks are configurable, be sure to consult the documentation.
31+
To completely disable a check, just comment it out or delete it from the file.
32+
Finally, it is worth reading the documentation.
33+
34+
-->
35+
36+
<module name="Checker">
37+
<!--
38+
If you set the basedir property below, then all reported file
39+
names will be relative to the specified directory. See
40+
http://checkstyle.sourceforge.net/5.x/config.html#Checker
41+
42+
<property name="basedir" value="${basedir}"/>
43+
-->
44+
45+
<!-- Checks that each Java package has a Javadoc file used for commenting. -->
46+
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
47+
<!-- <module name="JavadocPackage">
48+
<property name="allowLegacy" value="true"/>
49+
</module>-->
50+
51+
<!-- Checks whether files end with a new line. -->
52+
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
53+
<module name="NewlineAtEndOfFile"/>
54+
55+
<!-- Checks that property files contain the same keys. -->
56+
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
57+
<module name="Translation"/>
58+
59+
<module name="FileLength"/>
60+
61+
<!-- Following interprets the header file as regular expressions. -->
62+
<!-- <module name="RegexpHeader"/> -->
63+
64+
<module name="FileTabCharacter">
65+
<property name="eachLine" value="true"/>
66+
</module>
67+
68+
<module name="RegexpSingleline">
69+
<!-- \s matches whitespace character, $ matches end of line. -->
70+
<property name="format" value="\s+$"/>
71+
<property name="message" value="Line has trailing spaces."/>
72+
</module>
73+
74+
<module name="TreeWalker">
75+
76+
<property name="cacheFile" value="target/checkstyle_cache"/>
77+
78+
<!-- required for SuppressWarningsFilter (and other Suppress* rules not used here) -->
79+
<!-- see http://checkstyle.sourceforge.net/config_annotation.html#SuppressWarningsHolder -->
80+
<module name="SuppressWarningsHolder"/>
81+
82+
<!-- Checks for Javadoc comments. -->
83+
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
84+
<module name="JavadocMethod">
85+
<property name="scope" value="public"/>
86+
<property name="allowMissingReturnTag" value="true" />
87+
<property name="allowMissingParamTags" value="true" />
88+
</module>
89+
<module name="JavadocType"/>
90+
<module name="JavadocVariable">
91+
<property name="scope" value="public"/>
92+
</module>
93+
<module name="JavadocStyle"/>
94+
95+
96+
<!-- Checks for Naming Conventions. -->
97+
<!-- See http://checkstyle.sf.net/config_naming.html -->
98+
<module name="ConstantName"/>
99+
100+
<module name="LocalFinalVariableName">
101+
<property name="format" value="^[a-z][a-z0-9\_]*$"/>
102+
</module>
103+
104+
<module name="LocalVariableName">
105+
<property name="format" value="^[a-z][a-z0-9\_]*$"/>
106+
<property name="allowOneCharVarInForLoop" value="true"/>
107+
</module>
108+
109+
<module name="MemberName">
110+
<property name="format" value="^[a-z][a-z0-9\_]*$"/>
111+
</module>
112+
113+
<module name="ParameterName">
114+
<property name="format" value="^[a-z][a-z0-9\_]*$"/>
115+
</module>
116+
117+
<!--<module name="CatchParameterName">
118+
<property name="format" value="^[a-z][a-z0-9\_]+$"/>
119+
</module>-->
120+
121+
<module name="StaticVariableName">
122+
<property name="format" value="^[a-z][a-z0-9\_]*$"/>
123+
</module>
124+
125+
126+
<module name="MethodName"/>
127+
<module name="PackageName"/>
128+
<module name="TypeName"/>
129+
130+
131+
<!-- Checks for Headers -->
132+
<!-- See http://checkstyle.sf.net/config_header.html -->
133+
<!-- <module name="Header"> -->
134+
<!-- The follow property value demonstrates the ability -->
135+
<!-- to have access to ANT properties. In this case it uses -->
136+
<!-- the ${basedir} property to allow Checkstyle to be run -->
137+
<!-- from any directory within a project. See property -->
138+
<!-- expansion, -->
139+
<!-- http://checkstyle.sf.net/config.html#properties -->
140+
<!-- <property -->
141+
<!-- name="headerFile" -->
142+
<!-- value="${basedir}/java.header"/> -->
143+
<!-- </module> -->
144+
145+
146+
<!-- Checks for imports -->
147+
<!-- See http://checkstyle.sf.net/config_import.html -->
148+
<module name="AvoidStarImport"/>
149+
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
150+
<module name="RedundantImport"/>
151+
<module name="UnusedImports"/>
152+
153+
154+
<!-- Checks for Size Violations. -->
155+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
156+
<module name="LineLength"/>
157+
<module name="MethodLength"/>
158+
<module name="ParameterNumber"/>
159+
160+
161+
<!-- Checks for whitespace -->
162+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
163+
<module name="EmptyForIteratorPad"/>
164+
<module name="MethodParamPad"/>
165+
<module name="NoWhitespaceAfter"/>
166+
<module name="NoWhitespaceBefore"/>
167+
<module name="OperatorWrap"/>
168+
<module name="ParenPad"/>
169+
<module name="TypecastParenPad"/>
170+
<module name="WhitespaceAfter"/>
171+
<module name="WhitespaceAround"/>
172+
173+
174+
<!-- Modifier Checks -->
175+
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
176+
<module name="ModifierOrder"/>
177+
<module name="RedundantModifier"/>
178+
179+
180+
<!-- Checks for blocks. You know, those {}'s -->
181+
<!-- See http://checkstyle.sf.net/config_blocks.html -->
182+
<module name="AvoidNestedBlocks"/>
183+
<module name="EmptyBlock"/>
184+
<module name="LeftCurly"/>
185+
<module name="NeedBraces"/>
186+
<module name="RightCurly"/>
187+
188+
189+
<!-- Checks for common coding problems -->
190+
<!-- See http://checkstyle.sf.net/config_coding.html -->
191+
<module name="AvoidInlineConditionals"/>
192+
<module name="EmptyStatement"/>
193+
<module name="EqualsHashCode"/>
194+
<!-- <module name="HiddenField"/> -->
195+
<module name="IllegalInstantiation"/>
196+
<module name="InnerAssignment"/>
197+
<module name="MagicNumber"/>
198+
<module name="MissingSwitchDefault"/>
199+
<module name="SimplifyBooleanExpression"/>
200+
<module name="SimplifyBooleanReturn"/>
201+
202+
<!-- Checks for class design -->
203+
<!-- See http://checkstyle.sf.net/config_design.html -->
204+
<module name="DesignForExtension"/>
205+
<module name="FinalClass"/>
206+
<module name="HideUtilityClassConstructor"/>
207+
<module name="InterfaceIsType"/>
208+
<module name="VisibilityModifier"/>
209+
210+
211+
<!-- Miscellaneous other checks. -->
212+
<!-- See http://checkstyle.sf.net/config_misc.html -->
213+
<module name="ArrayTypeStyle"/>
214+
<module name="FinalParameters"/>
215+
<module name="TodoComment"/>
216+
<module name="UpperEll"/>
217+
218+
</module>
219+
220+
<!-- Support @SuppressWarnings (added in Checkstyle 5.7) -->
221+
<!-- see http://checkstyle.sourceforge.net/config.html#SuppressWarningsFilter -->
222+
<module name="SuppressWarningsFilter"/>
223+
224+
<!-- Checks properties file for a duplicated properties. -->
225+
<!-- See http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties -->
226+
<module name="UniqueProperties"/>
227+
228+
</module>

0 commit comments

Comments
 (0)