Skip to content

Commit b37f83a

Browse files
Add checkstyle
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/batik/trunk@1808002 13f79535-47bb-0310-9956-ffa450edef68
1 parent 6397b09 commit b37f83a

File tree

3 files changed

+212
-0
lines changed

3 files changed

+212
-0
lines changed

build.xml

+18
Original file line numberDiff line numberDiff line change
@@ -2585,5 +2585,23 @@ JAVA=/usr/bin/java
25852585
<fileset dir="classes" includes="**/*TestCase.class"/>
25862586
</batchtest>
25872587
</junit>
2588+
</target>
2589+
2590+
<target name="checkstyle" depends="init" description="Runs Checkstyle for a code quality report">
2591+
<property name="checkstyle.location" value="lib/checkstyle-5.6-all.jar" />
2592+
<property name="checkstyle.config" value="checkstyle.xml" />
2593+
<path id="checkstyle-classpath">
2594+
<pathelement location="${checkstyle.location}"/>
2595+
</path>
2596+
<taskdef name="checkstyle" classname="com.puppycrawl.tools.checkstyle.CheckStyleTask" classpathref="checkstyle-classpath"/>
2597+
<mkdir dir="${build}"/>
2598+
<checkstyle config="${checkstyle.config}" failonviolation="true" maxWarnings="0">
2599+
<classpath>
2600+
<path refid="checkstyle-classpath"/>
2601+
</classpath>
2602+
<fileset dir="." includes="**/*.java"/>
2603+
<formatter type="xml" toFile="${build}/report_checkstyle.xml"/>
2604+
<formatter type="plain"/>
2605+
</checkstyle>
25882606
</target>
25892607
</project>

checkstyle.xml

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
3+
<module name="Checker">
4+
<property name="severity" value="warning"/>
5+
6+
<!-- <module name="FileTabCharacter">
7+
<property name="severity" value="error"/>
8+
<property name="eachLine" value="true"/>
9+
</module>
10+
11+
<module name="NewlineAtEndOfFile"/> -->
12+
13+
<module name="RegexpHeader">
14+
<property name="severity" value="error"/>
15+
16+
<property name="header" value="\/\*\n\n Licensed to the Apache Software Foundation \(ASF\) under one or more\n contributor license agreements. See the NOTICE file distributed with\n this work for additional information regarding copyright ownership.\n The ASF licenses this file to You under the Apache License, Version 2.0\n \(the &quot;License&quot;\); you may not use this file except in compliance with\n the License. You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an &quot;AS IS&quot; BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n \*\/\n"/>
17+
</module>
18+
19+
<!-- <module name="RegexpSingleline">
20+
<property name="format" value="\s+$"/>
21+
<property name="message" value="Line has trailing spaces."/>
22+
</module>
23+
24+
<module name="RegexpSingleline">
25+
<property name="format" value="@author"/>
26+
<property name="message" value="Use of @author javadoc keyword is prohibited."/>
27+
</module>
28+
29+
30+
31+
<module name="SuppressionCommentFilter">
32+
<property name="offCommentFormat" value="CSOFF\: ([\w\|]+)"/>
33+
<property name="onCommentFormat" value="CSON\: ([\w\|]+)"/>
34+
<property name="checkFormat" value="$1"/>
35+
</module> -->
36+
37+
38+
<module name="SuppressionFilter">
39+
<property name="file" value="checkstylesuppressions.xml"/>
40+
</module>
41+
42+
<!-- <module name="TreeWalker">
43+
44+
<module name="LineLength">
45+
<property name="max" value="120"/>
46+
</module>
47+
48+
<module name="AnnotationUseStyle"/>
49+
50+
<module name="ArrayTypeStyle"/>
51+
52+
<module name="AvoidNestedBlocks"/>
53+
54+
<module name="AvoidStarImport">
55+
<property name="severity" value="error"/>
56+
</module>
57+
58+
<module name="ConstantName">
59+
<property name="format" value="^[A-Z](_?[A-Z0-9]+)*|log|is(Debug|Trace)Enabled$"/>
60+
</module>
61+
62+
<module name="DefaultComesLast"/>
63+
64+
<module name="EmptyBlock">
65+
<property name="tokens" value="LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_TRY,LITERAL_WHILE,STATIC_INIT"/>
66+
<property name="option" value="text"/>
67+
</module>
68+
69+
<module name="EmptyStatement"/>
70+
71+
<module name="EqualsHashCode"/>
72+
73+
<module name="ExplicitInitialization"/>
74+
75+
<module name="FileContentsHolder"/>
76+
77+
<module name="FinalClass"/>
78+
79+
<module name="GenericWhitespace"/>
80+
81+
<module name="HideUtilityClassConstructor"/>
82+
83+
<module name="IllegalImport"/>
84+
85+
<module name="ImportOrder">
86+
<property name="groups" value="java,javax,org,org.apache,org.apache.batik,org.apache.xmlgraphics,org.apache.fop,com"/>
87+
<property name="separated" value="true"/>
88+
</module>
89+
90+
<module name="InnerAssignment">
91+
<property name="tokens"
92+
value="BAND_ASSIGN,BOR_ASSIGN,BSR_ASSIGN,BXOR_ASSIGN,DIV_ASSIGN,MINUS_ASSIGN,MOD_ASSIGN,PLUS_ASSIGN,SL_ASSIGN,SR_ASSIGN,STAR_ASSIGN"/>
93+
</module>
94+
95+
<module name="LeftCurly"/>
96+
97+
<module name="LocalFinalVariableName"/>
98+
99+
<module name="LocalVariableName"/>
100+
101+
<module name="MemberName"/>
102+
103+
<module name="MethodName"/>
104+
105+
<module name="MethodParamPad"/>
106+
107+
<module name="MissingSwitchDefault"/>
108+
109+
<module name="ModifierOrder"/>
110+
111+
<module name="MultipleVariableDeclarations"/>
112+
113+
<module name="NeedBraces"/>
114+
115+
<module name="NoWhitespaceAfter">
116+
<property name="allowLineBreaks" value="false"/>
117+
<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
118+
</module>
119+
120+
<module name="NoWhitespaceBefore"/>
121+
122+
<module name="OneStatementPerLine"/>
123+
124+
<module name="OperatorWrap"/>
125+
126+
<module name="PackageName"/>
127+
128+
<module name="ParameterName"/>
129+
130+
<module name="ParenPad"/>
131+
132+
<module name="RedundantImport"/>
133+
134+
<module name="RedundantModifier"/>
135+
136+
<module name="RightCurly"/>
137+
138+
<module name="SimplifyBooleanExpression"/>
139+
140+
<module name="SimplifyBooleanReturn"/>
141+
142+
<module name="StaticVariableName"/>
143+
144+
<module name="TypeName"/>
145+
146+
<module name="TypecastParenPad">
147+
<property name="tokens" value="RPAREN,TYPECAST"/>
148+
</module>
149+
150+
<module name="UnusedImports"/>
151+
152+
<module name="UpperEll"/>
153+
154+
<module name="WhitespaceAfter">
155+
<property name="tokens" value="COMMA,SEMI"/>
156+
</module>
157+
158+
<module name="WhitespaceAround">
159+
<property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,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,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,TYPE_EXTENSION_AND,WILDCARD_TYPE"/>
160+
<property name="ignoreEnhancedForColon" value="false"/>
161+
</module>
162+
<module name="JavadocMethod">
163+
<property name="allowMissingJavadoc" value="true"/>
164+
<property name="allowMissingParamTags" value="true"/>
165+
<property name="allowMissingReturnTag" value="true"/>
166+
<property name="allowMissingThrowsTags" value="true"/>
167+
</module>
168+
169+
</module> -->
170+
171+
172+
</module>

checkstylesuppressions.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
3+
<suppressions>
4+
<suppress files="NodeXBL.java" checks="RegexpHeader"/>
5+
<suppress files="OriginalEvent.java" checks="RegexpHeader"/>
6+
<suppress files="ShadowTreeEvent.java" checks="RegexpHeader"/>
7+
<suppress files="XBLShadowTreeElement.java" checks="RegexpHeader"/>
8+
<suppress files="CustomEvent.java" checks="RegexpHeader"/>
9+
<suppress files="DocumentEvent.java" checks="RegexpHeader"/>
10+
<suppress files="Event.java" checks="RegexpHeader"/>
11+
<suppress files="EventException.java" checks="RegexpHeader"/>
12+
<suppress files="EventListener.java" checks="RegexpHeader"/>
13+
<suppress files="EventTarget.java" checks="RegexpHeader"/>
14+
<suppress files="KeyboardEvent.java" checks="RegexpHeader"/>
15+
<suppress files="MouseEvent.java" checks="RegexpHeader"/>
16+
<suppress files="MutationEvent.java" checks="RegexpHeader"/>
17+
<suppress files="MutationNameEvent.java" checks="RegexpHeader"/>
18+
<suppress files="TextEvent.java" checks="RegexpHeader"/>
19+
<suppress files="UIEvent.java" checks="RegexpHeader"/>
20+
<suppress files="Global.java" checks="RegexpHeader"/>
21+
<suppress files="SVGGlobal.java" checks="RegexpHeader"/>
22+
</suppressions>

0 commit comments

Comments
 (0)