PR: MPPMD-5
Add CPD report patch git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114765 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7d730fc502
commit
23288e17e7
@ -19,6 +19,11 @@
|
||||
pluginName="pmd"
|
||||
description="Verification of coding rules."
|
||||
link="pmd-report"/>
|
||||
<doc:registerReport
|
||||
name="CPD Report"
|
||||
pluginName=""
|
||||
description="Detection of copy-paste code."
|
||||
link="cpd-report"/>
|
||||
</j:if>
|
||||
</goal>
|
||||
|
||||
@ -30,6 +35,7 @@
|
||||
<goal name="maven-pmd-plugin:deregister">
|
||||
<j:if test="${sourcesPresent}">
|
||||
<doc:deregisterReport name="PMD Report"/>
|
||||
<doc:deregisterReport name="CPD Report"/>
|
||||
</j:if>
|
||||
</goal>
|
||||
|
||||
@ -118,6 +124,63 @@
|
||||
prettyPrint="true"
|
||||
/>
|
||||
|
||||
<!-- Generate CPD report if it is enabled -->
|
||||
<j:set var="enable" value="${maven.pmd.cpd.enable}"/>
|
||||
|
||||
<j:if test="${enable == 'true'}">
|
||||
<attainGoal name="pmd:cpd-report"/>
|
||||
</j:if>
|
||||
</goal>
|
||||
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Generate the CPD report.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="pmd:cpd-report"
|
||||
description="Generate duplicate source code report with CPD">
|
||||
|
||||
<!-- Define a CPD task from the PMD jar -->
|
||||
<taskdef name="cpd"
|
||||
classpath="${plugin.getDependencyPath('pmd:pmd')}"
|
||||
classname="net.sourceforge.pmd.cpd.CPDTask"/>
|
||||
|
||||
<!-- Run the CPD task -->
|
||||
<echo>Running the CPD task with minimumTokenCount = ${maven.pmd.cpd.minimumtokencount} ...</echo>
|
||||
|
||||
<cpd minimumTokenCount="${maven.pmd.cpd.minimumtokencount}"
|
||||
outputFile="${maven.build.dir}/cpd-raw-report.txt">
|
||||
<!-- cut and paste from pmd:report -->
|
||||
<fileset dir="${pom.build.sourceDirectory}"
|
||||
includes="${maven.pmd.includes}"
|
||||
excludes="${maven.pmd.excludes}">
|
||||
|
||||
<!-- FIXME: This is a bad cut and paste -->
|
||||
<!-- handle source modifications -->
|
||||
<j:forEach var="sm" items="${pom.build.sourceModifications}">
|
||||
<available property="classPresent" classname="${sm.className}"/>
|
||||
<j:if test="${classPresent != 'true'}">
|
||||
<j:forEach var="exclude" items="${sm.excludes}">
|
||||
<exclude name="${exclude}"/>
|
||||
</j:forEach>
|
||||
<j:forEach var="include" items="${sm.includes}">
|
||||
<include name="${include}"/>
|
||||
</j:forEach>
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
</fileset>
|
||||
</cpd>
|
||||
|
||||
<!-- Convert raw text report into XDOC -->
|
||||
|
||||
<j:set var="genDocs" value="${maven.gen.docs}" />
|
||||
<doc:text-xdoc
|
||||
title="CPD Report"
|
||||
section="CPD Report"
|
||||
inputFile="${maven.build.dir}/cpd-raw-report.txt"
|
||||
output="${genDocs}/cpd-report.xml"
|
||||
/>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
|
||||
@ -15,3 +15,11 @@ maven.pmd.rulesetfiles=${plugin.resources}/rulesets/basic.xml,${plugin.resources
|
||||
|
||||
maven.pmd.includes = **/*.java
|
||||
maven.pmd.excludes =
|
||||
|
||||
# enable/disable CPD
|
||||
|
||||
maven.pmd.cpd.enable = false
|
||||
|
||||
# minimum length of token sequences considered equal
|
||||
|
||||
maven.pmd.cpd.minimumtokencount = 100
|
||||
|
||||
@ -15,6 +15,9 @@
|
||||
<action dev="dion" type="update">
|
||||
Apply MAVEN-1008. Allow for custom rulesets in the classpath.
|
||||
</action>
|
||||
<action dev="brett" type="add" issue="MPPMD-5" due-to="Morten Kvistgaard">
|
||||
Apply MPPMD-5. Add support for CPD report.
|
||||
</action>
|
||||
</release>
|
||||
|
||||
<release version="1.2" date="2003-09-20">
|
||||
|
||||
@ -54,6 +54,21 @@
|
||||
exclude any files.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.pmd.cpd.enable</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Enable/disable the CPD report. Defaults to "false".
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.pmd.cpd.minimumtokencount</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Specifies the minimal number required to consider two sequences of
|
||||
tokens identical. Defaults to "100".
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user