Skip to content

Commit 2b27902

Browse files
committed
adding checkstyle config
1 parent 878cb1d commit 2b27902

2 files changed

Lines changed: 196 additions & 0 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/.gradle/
22
/.idea/
3+
/build/

‎config/checkstyle/checkstyle.xml‎

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
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+
If you set the basedir property below, then all reported file
36+
names will be relative to the specified directory. See
37+
http://checkstyle.sourceforge.net/5.x/config.html#Checker
38+
39+
<property name="basedir" value="${basedir}"/>
40+
-->
41+
42+
<!-- Checks that a package-info.java file exists for each package. -->
43+
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
44+
<!--<module name="JavadocPackage"/>-->
45+
46+
<!-- Checks whether files end with a new line. -->
47+
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
48+
<module name="NewlineAtEndOfFile">
49+
<property name="lineSeparator" value="lf"/>
50+
</module>
51+
52+
<!-- Checks that property files contain the same keys. -->
53+
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
54+
<module name="Translation"/>
55+
56+
<!-- Checks for Size Violations. -->
57+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
58+
<module name="FileLength"/>
59+
60+
<!-- Checks for whitespace -->
61+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
62+
<module name="FileTabCharacter"/>
63+
64+
<!-- Miscellaneous other checks. -->
65+
<!-- See http://checkstyle.sf.net/config_misc.html -->
66+
<module name="RegexpSingleline">
67+
<property name="format" value="\s+$"/>
68+
<property name="minimum" value="0"/>
69+
<property name="maximum" value="0"/>
70+
<property name="message" value="Line has trailing spaces."/>
71+
</module>
72+
73+
<module name="TreeWalker">
74+
75+
<!-- Checks for Javadoc comments. -->
76+
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
77+
<module name="JavadocMethod"/>
78+
<module name="JavadocType"/>
79+
<!--<module name="JavadocVariable"/>-->
80+
<module name="JavadocStyle"/>
81+
82+
83+
<!-- Checks for Naming Conventions. -->
84+
<!-- See http://checkstyle.sf.net/config_naming.html -->
85+
<module name="ConstantName"/>
86+
<module name="LocalFinalVariableName"/>
87+
<module name="LocalVariableName"/>
88+
<module name="MemberName"/>
89+
<module name="MethodName"/>
90+
<module name="PackageName"/>
91+
<module name="ParameterName"/>
92+
<module name="StaticVariableName"/>
93+
<module name="TypeName"/>
94+
95+
96+
<!-- Checks for Headers -->
97+
<!-- See http://checkstyle.sf.net/config_header.html -->
98+
<!-- <module name="Header"> -->
99+
<!-- The follow property value demonstrates the ability -->
100+
<!-- to have access to ANT properties. In this case it uses -->
101+
<!-- the ${basedir} property to allow Checkstyle to be run -->
102+
<!-- from any directory within a project. See property -->
103+
<!-- expansion, -->
104+
<!-- http://checkstyle.sf.net/config.html#properties -->
105+
<!-- <property -->
106+
<!-- name="headerFile" -->
107+
<!-- value="${basedir}/java.header"/> -->
108+
<!-- </module> -->
109+
110+
<!-- Following interprets the header file as regular expressions. -->
111+
<!-- <module name="RegexpHeader"/> -->
112+
113+
114+
<!-- Checks for imports -->
115+
<!-- See http://checkstyle.sf.net/config_import.html -->
116+
<module name="AvoidStarImport"/>
117+
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
118+
<module name="RedundantImport"/>
119+
<module name="UnusedImports"/>
120+
121+
122+
<!-- Checks for Size Violations. -->
123+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
124+
<module name="LineLength">
125+
<property name="max" value="120"/>
126+
</module>
127+
<module name="MethodLength"/>
128+
<module name="ParameterNumber">
129+
<property name="max" value="5"/>
130+
</module>
131+
132+
133+
<!-- Checks for whitespace -->
134+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
135+
<module name="EmptyForIteratorPad"/>
136+
<module name="GenericWhitespace"/>
137+
<module name="MethodParamPad"/>
138+
<module name="NoWhitespaceAfter"/>
139+
<module name="NoWhitespaceBefore"/>
140+
<module name="OperatorWrap"/>
141+
<module name="ParenPad"/>
142+
<module name="TypecastParenPad"/>
143+
<module name="WhitespaceAfter"/>
144+
<module name="WhitespaceAround"/>
145+
146+
147+
<!-- Modifier Checks -->
148+
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
149+
<module name="ModifierOrder"/>
150+
<module name="RedundantModifier"/>
151+
152+
153+
<!-- Checks for blocks. You know, those {}'s -->
154+
<!-- See http://checkstyle.sf.net/config_blocks.html -->
155+
<module name="AvoidNestedBlocks"/>
156+
<module name="EmptyBlock"/>
157+
<module name="LeftCurly"/>
158+
<module name="NeedBraces"/>
159+
<module name="RightCurly"/>
160+
161+
162+
<!-- Checks for common coding problems -->
163+
<!-- See http://checkstyle.sf.net/config_coding.html -->
164+
<!--<module name="AvoidInlineConditionals"/>-->
165+
<module name="EmptyStatement"/>
166+
<module name="EqualsHashCode"/>
167+
<!--<module name="HiddenField"/>-->
168+
<module name="IllegalInstantiation"/>
169+
<module name="InnerAssignment"/>
170+
<module name="MagicNumber"/>
171+
<module name="MissingSwitchDefault"/>
172+
<module name="SimplifyBooleanExpression"/>
173+
<module name="SimplifyBooleanReturn"/>
174+
175+
<!-- Checks for class design -->
176+
<!-- See http://checkstyle.sf.net/config_design.html -->
177+
<!--<module name="DesignForExtension"/>-->
178+
<module name="FinalClass"/>
179+
<module name="HideUtilityClassConstructor"/>
180+
<module name="InterfaceIsType"/>
181+
<module name="VisibilityModifier">
182+
<property name="protectedAllowed" value="true"/>
183+
</module>
184+
185+
186+
<!-- Miscellaneous other checks. -->
187+
<!-- See http://checkstyle.sf.net/config_misc.html -->
188+
<module name="ArrayTypeStyle"/>
189+
<module name="FinalParameters"/>
190+
<module name="TodoComment"/>
191+
<module name="UpperEll"/>
192+
193+
</module>
194+
195+
</module>

0 commit comments

Comments
 (0)