Skip to content

Commit

Permalink
Updated for new PMD version
Browse files Browse the repository at this point in the history
git-svn-id: https://cdk.svn.sourceforge.net/svnroot/cdk/trunk/cdk@3695 eb4e18e3-b210-0410-a6ab-dec725e4b171
  • Loading branch information
egonw committed Feb 1, 2005
1 parent 347f99e commit 3e04bca
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 17 deletions.
38 changes: 25 additions & 13 deletions pmd.xml
Expand Up @@ -15,12 +15,14 @@
</fileset>
</path>

<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"
<taskdef name="pmd" id="pmd" classname="net.sourceforge.pmd.ant.PMDTask"
classpathref="pmd.classpath"/>

<target name="pmd" depends="pmd-data, pmd-core, pmd-standard, pmd-io, pmd-extra, pmd-render, pmd-applications, pmd-libio, pmd-experimental"/>
<target name="pmd" id="pmd" depends="pmd-data, pmd-core, pmd-standard, pmd-io,
pmd-extra, pmd-render, pmd-applications, pmd-libio, pmd-experimental,
pmd-builder3d, pmd-test"/>

<target name="pmd-data">
<target name="pmd-data" id="pmd-data">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom-data.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/data.html"/>
Expand All @@ -30,7 +32,7 @@
</pmd>
</target>

<target name="pmd-core">
<target name="pmd-core" id="pmd-core">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/core.html"/>
Expand All @@ -40,7 +42,7 @@
</pmd>
</target>

<target name="pmd-standard">
<target name="pmd-standard" id="pmd-standard">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/standard.html"/>
Expand All @@ -50,7 +52,7 @@
</pmd>
</target>

<target name="pmd-io">
<target name="pmd-io" id="pmd-io">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/io.html"/>
Expand All @@ -60,7 +62,7 @@
</pmd>
</target>

<target name="pmd-render">
<target name="pmd-render" id="pmd-render">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/render.html"/>
Expand All @@ -70,7 +72,7 @@
</pmd>
</target>

<target name="pmd-extra">
<target name="pmd-extra" id="pmd-extra">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/extra.html"/>
Expand All @@ -80,7 +82,7 @@
</pmd>
</target>

<target name="pmd-applications">
<target name="pmd-applications" id="pmd-applications">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/applications.html"/>
Expand All @@ -90,7 +92,7 @@
</pmd>
</target>

<target name="pmd-libio">
<target name="pmd-libio" id="pmd-libio">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/libio.html"/>
Expand All @@ -100,7 +102,7 @@
</pmd>
</target>

<target name="pmd-experimental">
<target name="pmd-experimental" id="pmd-experimental">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/experimental.html"/>
Expand All @@ -110,7 +112,7 @@
</pmd>
</target>

<target name="pmd-qsar">
<target name="pmd-qsar" id="pmd-qsar">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/qsar.html"/>
Expand All @@ -120,7 +122,7 @@
</pmd>
</target>

<target name="pmd-builder3d">
<target name="pmd-builder3d" id="pmd-builder3d">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/builder3d.html"/>
Expand All @@ -130,4 +132,14 @@
</pmd>
</target>

<target name="pmd-test" id="pmd-test">
<mkdir dir="${reports.tests}/pmd"/>
<pmd shortFilenames="true" rulesetfiles="pmd/custom-test.xml">
<formatter type="summaryhtml" toFile="${reports.tests}/pmd/test.html"/>
<fileset dir="${src}">
<includesfile name="${src}/test.javafiles"/>
</fileset>
</pmd>
</target>

</project>
4 changes: 3 additions & 1 deletion pmd/custom-data.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<ruleset name="custom">
<ruleset name="custom-data">

<description>
This ruleset checks the CDK sources for bad code.
Expand All @@ -17,6 +17,8 @@
<rule ref="rulesets/imports.xml"/>
<rule ref="rulesets/strings.xml"/>
<rule ref="rulesets/codesize.xml"/>
<rule ref="rulesets/strictexception.xml"/>
<rule ref="rulesets/clone.xml"/>

<!-- Rules specific for CDK -->

Expand Down
22 changes: 22 additions & 0 deletions pmd/custom-test.xml
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<ruleset name="custom">

<description>
This ruleset checks the CDK sources for bad code.
</description>

<!-- In the below paths, rulesets/ refers to the classpath, and the
pmd/ refers to this directory, and needs to be excluded because
the are called from ../pmd.xml -->

<!-- The rule sets that come with PMD -->

<rule ref="rulesets/basic.xml"/>
<rule ref="rulesets/unusedcode.xml"/>
<rule ref="rulesets/imports.xml"/>

<!-- Rules specific for CDK -->

<rule ref="pmd/customJunit.xml"/>

</ruleset>
2 changes: 2 additions & 0 deletions pmd/custom.xml
Expand Up @@ -17,9 +17,11 @@
<rule ref="rulesets/imports.xml"/>
<rule ref="rulesets/strings.xml"/>
<rule ref="rulesets/codesize.xml"/>
<rule ref="rulesets/strictexception.xml"/>

<!-- Rules specific for CDK -->

<rule ref="pmd/customCDK.xml"/>
<rule ref="pmd/customOptimization.xml"/>

</ruleset>
22 changes: 19 additions & 3 deletions pmd/customCDK.xml
Expand Up @@ -19,12 +19,28 @@
<![CDATA[
//TryStatement[@Catch='true'][not(FormalParameter/following-sibling::Block//Name[@Image='logger.debug'])]
]]>
<!-- old one:
//TryStatement[@Catch='true']//StatementExpression/PrimaryExpression[PrimaryPrefix/Name/@Image = 'logger.debug'][PrimarySuffix/Arguments//Name[@Image = ../../../../../../../../../../../../FormalParameter/VariableDeclaratorId/@Image]][count(*) = 0]
-->
</value>
</property>
</properties>
</rule>

<rule name="CDK_MoreThanOneLoggingToolInstantiated"
message="More than one LoggingTool is instantiated"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Detects instantiation of more than one LoggingTool.
</description>
<priority>3</priority>
<properties>
<property name="xpath" pluginname="true">
<value>
<![CDATA[
//ClassBody[count(//VariableDeclarator[../Type/Name[@Image='LoggingTool']]) &gt;1 ]
]]>
</value>
</property>
</properties>
</rule>


</ruleset>
12 changes: 12 additions & 0 deletions pmd/customJunit.xml
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<ruleset name="customJunit">

<description>
This ruleset checks the CDK sources for bad code.
</description>

<rule ref="rulesets/junit.xml">
<exclude name="JUnitAssertionsShouldIncludeMessage"/>
</rule>

</ruleset>
12 changes: 12 additions & 0 deletions pmd/customOptimization.xml
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<ruleset name="customOptimization">

<description>
This ruleset checks the CDK sources for bad code.
</description>

<rule ref="rulesets/junit.xml">
<exclude name="MethodArgumentCouldBeFinal"/>
</rule>

</ruleset>

0 comments on commit 3e04bca

Please sign in to comment.