Android PMD 5

Posted: February 12, 2010 in Android
Tags: ,

PMD 5 comes with some new additions to the Android Rules and a nice new features in that you can define a rulest and stick outside the pmd.jar unlike PMD 4. Thus for an ANT target you have:

 <!-- PMD -->
			    <target name="pmd" >
                           <pmd rulesetfiles="config/androidrules.xml">
			    	                <pathelement location="${sdk-android-jar}"/>
			    	                <pathelement location="${out.classes.absolute.dir}" />
			    	                <fileset dir="libs">
			    	                    <include name="*.jar" />
			    	            <formatter type="xml" toFile="reports/pmd.xml"/>
			    	            <!-- <ruleset>rulesets/java/android.xml</ruleset> -->
			    	            <fileset dir="${source-folder}" includes="**/*.java" />
			    	    <xslt basedir="reports" destdir="reports"
			    		<param name="project" expression="${project}"/>
			    		<param name="today" expression="${today}"/>  
			    		<param name="rulesets" expression="android"/>
			    		<mapper type="glob" from="pmd.xml" to="pmd.html"/>
					   <echo>pmd report generated and transformed to html</echo>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s