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

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s