Merge lp:~trond-norbye/gearman-java/pmd_support into lp:gearman-java

Proposed by Trond Norbye
Status: Merged
Merged at revision: not available
Proposed branch: lp:~trond-norbye/gearman-java/pmd_support
Merge into: lp:gearman-java
Diff against target: None lines
To merge this branch: bzr merge lp:~trond-norbye/gearman-java/pmd_support
Reviewer Review Type Date Requested Status
Gearman-developers Pending
Review via email: mp+9711@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Trond Norbye (trond-norbye) wrote :

Added support for running PMD on the source

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'build.xml'
2--- build.xml 2009-07-16 23:40:07 +0000
3+++ build.xml 2009-08-05 18:34:44 +0000
4@@ -11,6 +11,7 @@
5 <property name="dist.docs.dir" location="${dist.dir}/docs" />
6 <property name="dist.jar" location="${dist.lib.dir}/${ant.project.name}-${project.version}.jar"/>
7 <property name="api.pkg" value="org.gearman"/>
8+ <property name="pmd.home" value="${user.home}/.ant/lib/pmd"/>
9 <path id="build.classpath">
10 <pathelement location="${build.classes.dir}" />
11 </path>
12@@ -20,6 +21,34 @@
13 <pathelement location="${junit.jar}" />
14 </path>
15
16+ <path id="pmd.lib.search.path">
17+ <pathelement path="${pmd.home}/lib/"/>
18+ <pathelement path="${java.class.path}"/>
19+ <pathelement path="lib/pmd/lib/"/>
20+ </path>
21+
22+ <target name="-check_pmd" description="Check that pmd jar files are present">
23+ <available file="pmd.jar" type="file" property="pmd.jar.present">
24+ <filepath refid="pmd.lib.search.path"/>
25+ </available>
26+ <fail unless="pmd.jar.present" message="Please install pmd.jar in lib-directory (or in ant classpath) to run PMD."/>
27+ </target>
28+
29+ <target name="pmd" depends="compile, -check_pmd" description="Check the code with PMD">
30+ <path id="pmd.lib" >
31+ <pathelement location="${pmd.home}/lib/pmd.jar"/>
32+ <pathelement location="${pmd.home}/lib/jaxen.jar"/>
33+ </path>
34+ <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
35+ <mkdir dir="build/pmd"/>
36+ <pmd targetjdk="1.6" failuresPropertyName="pmd.num.warnings" rulesetfiles="tools/pmd/ruleset.xml">
37+ <formatter type="html" toFile="build/pmd/report.html"/>
38+ <formatter type="xml" toFile="build/pmd/report.xml"/>
39+ <fileset dir="src" includes="**/*.java"/>
40+ </pmd>
41+ <echo message="PMD finished, found ${pmd.num.warnings} warnings, see pmd/pmd_report.html"/>
42+ </target>
43+
44 <target name="usage">
45 <echo message="Build the ${ant.project.name} project."/>
46 <echo message=""/>
47
48=== added directory 'tools'
49=== added directory 'tools/pmd'
50=== added file 'tools/pmd/ruleset.xml'
51--- tools/pmd/ruleset.xml 1970-01-01 00:00:00 +0000
52+++ tools/pmd/ruleset.xml 2009-08-05 18:34:44 +0000
53@@ -0,0 +1,31 @@
54+<?xml version="1.0" encoding="UTF-8"?>
55+<ruleset name="Custom ruleset for Gearman Java driver"
56+ xmlns="http://pmd.sf.net/ruleset/1.0.0"
57+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
58+ xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
59+ xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
60+
61+ <description>PMD settings for lp:gearman-java</description>
62+
63+ <rule ref="rulesets/strings.xml"/>
64+ <rule ref="rulesets/basic.xml"/>
65+ <rule ref="rulesets/braces.xml"/>
66+ <rule ref="rulesets/clone.xml"/>
67+ <rule ref="rulesets/design.xml"/>
68+ <rule ref="rulesets/finalizers.xml"/>
69+ <rule ref="rulesets/imports.xml"/>
70+ <rule ref="rulesets/junit.xml"/>
71+ <rule ref="rulesets/logging-java.xml"/>
72+ <rule ref="rulesets/migrating.xml"/>
73+ <rule ref="rulesets/optimizations.xml">
74+ <!-- The following rules generate a lot of warnings... -->
75+ <exclude name="LocalVariableCouldBeFinal"/>
76+ <exclude name="MethodArgumentCouldBeFinal"/>
77+ </rule>
78+ <rule ref="rulesets/strictexception.xml"/>
79+ <rule ref="rulesets/strings.xml"/>
80+ <rule ref="rulesets/sunsecure.xml"/>
81+ <rule ref="rulesets/typeresolution.xml"/>
82+ <rule ref="rulesets/unusedcode.xml"/>
83+
84+</ruleset>

Subscribers

People subscribed via source and target branches