forked from phoedos/pmd
New ant target to run PMD on the PMD sources with 20 rules that we could enforce at one point
Small change to copy all rulesets cleanly Added proper target dependencies to pmd target, same as pmdOnPmd git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4966 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -46,21 +46,15 @@
|
||||
<mkdir dir="${dir.lib}" />
|
||||
<copy todir="${dir.build}rulesets">
|
||||
<fileset dir="${dir.rulesets}">
|
||||
<include name="*.xml" />
|
||||
<include name="*.properties" />
|
||||
<include name="**/*.xml" />
|
||||
<include name="**/*.properties" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${dir.build}/test/net/sourceforge/pmd">
|
||||
<fileset dir="${dir.regress}/test/net/sourceforge/pmd">
|
||||
<include name="**/xml/*.xml" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<mkdir dir="${dir.build}/rulesets/releases" />
|
||||
<copy todir="${dir.build}rulesets/releases">
|
||||
<fileset dir="${dir.rulesets}/releases">
|
||||
<include name="*.xml" />
|
||||
<copy todir="${dir.build}/test/net/sourceforge/pmd">
|
||||
<fileset dir="${dir.regress}/test/net/sourceforge/pmd">
|
||||
<include name="**/xml/*.xml" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="jar" depends="copy,compile" description="Jars up the classes and rulesets">
|
||||
@ -76,7 +70,7 @@
|
||||
<jar jarfile="${dir.lib}\pmd-src-${version}.jar" basedir="${dir.src}" />
|
||||
</target>
|
||||
|
||||
<target name="pmd" description="Runs PMD">
|
||||
<target name="pmd" description="Runs PMD" depends="copy, compile">
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="dependencies.path" />
|
||||
<pmd rulesetfiles="unusedcode" shortFilenames="true">
|
||||
<classpath>
|
||||
@ -88,6 +82,21 @@
|
||||
</fileset>
|
||||
</pmd>
|
||||
</target>
|
||||
|
||||
<target name="pmdOnPmd" description="Runs PMD on PMD" depends="copy, compile">
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="dependencies.path" />
|
||||
<pmd rulesetfiles="${dir.rulesets}internal\dogfood.xml" shortFilenames="true">
|
||||
<classpath>
|
||||
<path refid="dependencies.path" />
|
||||
</classpath>
|
||||
<formatter type="text" toConsole="true"/>
|
||||
<fileset dir="${dir.src}">
|
||||
<include name="**/*.java" />
|
||||
<exclude name="**/ast/*.java" />
|
||||
<exclude name="**/cppast/*.java" />
|
||||
</fileset>
|
||||
</pmd>
|
||||
</target>
|
||||
|
||||
<target name="requires-junit" description="Ensures JUnit is available">
|
||||
<available classname="junit.framework.Test" property="junit.available" classpathref="dependencies.path" />
|
||||
|
61
pmd/rulesets/internal/dogfood.xml
Normal file
61
pmd/rulesets/internal/dogfood.xml
Normal file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="dogfood"
|
||||
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||
|
||||
<description>
|
||||
Rules to check PMD itself
|
||||
</description>
|
||||
|
||||
<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>
|
||||
|
||||
<rule ref="rulesets/basic.xml/BooleanInstantiation"/>
|
||||
|
||||
<rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
|
||||
|
||||
<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>
|
||||
|
||||
<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
|
||||
|
||||
<rule ref="rulesets/design.xml/IdempotentOperations"/>
|
||||
|
||||
<rule ref="rulesets/strictexception.xml/AvoidRethrowingException"/>
|
||||
|
||||
<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>
|
||||
|
||||
<rule ref="rulesets/optimizations.xml/UnnecessaryWrapperObjectCreation"/>
|
||||
|
||||
<rule ref="rulesets/strings.xml/UselessStringValueOf"/>
|
||||
|
||||
<!-- Null checks -->
|
||||
<rule ref="rulesets/basic.xml/BrokenNullCheck"/>
|
||||
|
||||
<rule ref="rulesets/basic.xml/MisplacedNullCheck"/>
|
||||
|
||||
<rule ref="rulesets/design.xml/EqualsNull"/>
|
||||
<!-- Null checks End -->
|
||||
|
||||
<!-- Empty thingies -->
|
||||
<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>
|
||||
|
||||
<rule ref="rulesets/basic.xml/EmptyTryBlock"/>
|
||||
|
||||
<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>
|
||||
|
||||
<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>
|
||||
|
||||
<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>
|
||||
|
||||
<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>
|
||||
<!-- Empty thingies End -->
|
||||
|
||||
<!-- Unused code-->
|
||||
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
|
||||
|
||||
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
|
||||
<!-- Unused code End-->
|
||||
|
||||
</ruleset>
|
Reference in New Issue
Block a user