Skip to content

Commit edd5d23

Browse files
committed
Added checkstyle checks
1 parent 87ae5e6 commit edd5d23

5 files changed

Lines changed: 37 additions & 6 deletions

File tree

5.21 MB
Binary file not shown.

build.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" ?>
22
<project name="SampleBuildWithAnt" default="war">
3+
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
4+
classpath="WebContent/WEB-INF/lib/checkstyle-7.8.2-all.jar"/>
35
<path id="compile.classpath">
46
<fileset dir="WebContent/WEB-INF/lib">
57
<include name="*.jar"/>
@@ -44,4 +46,17 @@
4446
</junit>
4547
</target>
4648

49+
<target name="checkstyle"
50+
description="Generates a report of code convention violations.">
51+
52+
<checkstyle config="sun_checks.xml"
53+
failureProperty="checkstyle.failure"
54+
failOnViolation="false">
55+
<formatter type="xml" tofile="checkstyle_report.xml"/>
56+
<fileset dir="src/example" includes="**/*.java"/>
57+
</checkstyle>
58+
59+
<!--style in="checkstyle_report.xml" out="checkstyle_report.html" style="checkstyle.xsl"/-->
60+
</target>
61+
4762
</project>

src/example/junit/TestCalculator.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
package junit;
22

3-
import static org.junit.Assert.*;
4-
5-
63
import org.junit.After;
74
import org.junit.Before;
85
import org.junit.Test;
6+
import org.junit.Assert.*;
97

10-
import static org.junit.Assert.*;
11-
12-
138
public class TestCalculator {
149

1510
private math.Calculator calc;

src/example/math/package-info.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
*
3+
*/
4+
/**
5+
* @author ajay.srinivasa
6+
*
7+
*/
8+
package math;

sun_checks.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4+
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
5+
6+
<module name="Checker">
7+
<module name="JavadocPackage"/>
8+
<module name="TreeWalker">
9+
<module name="AvoidStarImport"/>
10+
<module name="ConstantName"/>
11+
<module name="EmptyBlock"/>
12+
</module>
13+
</module>

0 commit comments

Comments
 (0)