git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113253 13f79535-47bb-0310-9956-ffa450edef68
125 lines
4.9 KiB
XML
125 lines
4.9 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<jsl:stylesheet
|
|
select="$doc"
|
|
xmlns:j="jelly:core"
|
|
xmlns:jsl="jelly:jsl"
|
|
xmlns:util="jelly:util"
|
|
xmlns:x="jelly:xml"
|
|
xmlns:doc="doc"
|
|
xmlns="dummy" trim="false">
|
|
|
|
<!-- This needs to be instantiated here to be available in the template matches -->
|
|
<j:useBean var="mavenTool" class="org.apache.maven.MavenTool"/>
|
|
<j:useBean var="htmlescape" class="org.apache.velocity.anakia.Escape"/>
|
|
<j:useBean var="fileutil" class="org.apache.velocity.texen.util.FileUtil"/>
|
|
<j:useBean var="pathtool" class="org.apache.maven.DVSLPathTool"/>
|
|
|
|
<jsl:template match="pmd">
|
|
<document>
|
|
|
|
<properties>
|
|
<title>PMD Results</title>
|
|
</properties>
|
|
|
|
<body>
|
|
<section name="PMD Results">
|
|
<p>
|
|
The following document contains the results of
|
|
<a
|
|
href="http://pmd.sourceforge.net/">PMD</a>.
|
|
</p>
|
|
</section>
|
|
|
|
<section name="Summary">
|
|
<j:set var="fileCount"><x:expr select="count(file)"/></j:set>
|
|
<j:set var="errorCount"><x:expr select="count(file/violation)"/></j:set>
|
|
<table>
|
|
<tr>
|
|
<th>Files</th>
|
|
<th>Errors</th>
|
|
</tr>
|
|
<tr>
|
|
<td><doc:formatAsNumber string="${fileCount}" pattern="0"/></td>
|
|
<td><doc:formatAsNumber string="${errorCount}" pattern="0"/></td>
|
|
</tr>
|
|
</table>
|
|
</section>
|
|
|
|
<section name="Files">
|
|
<table>
|
|
<tr>
|
|
<th>Files</th>
|
|
<th>Violations</th>
|
|
</tr>
|
|
<j:set var="fullSrcDir" value="${pom.build.sourceDirectory}"/>
|
|
<j:set var="srcDir" value="${fileutil.file(fullSrcDir).getAbsolutePath()}"/>
|
|
<j:set var="srcDirLength" value="${srcDir.length() + 1}"/>
|
|
<x:set var="files" select="file"/>
|
|
<!-- x:forEach is busted -->
|
|
<j:forEach var="file" items="${files}">
|
|
<!-- Type coercion doesn't work worth a fuck in jexl. -->
|
|
<j:set var="name" value="${file.attribute('name').getValue()}"/>
|
|
<j:set var="name" value="${name.substring(mavenTool.toInteger(srcDirLength.toString()))}"/>
|
|
<util:replace var="name" value="${name}" oldChar="\\" newChar="/"/>
|
|
<!--- +1 is for the trailing slash above -->
|
|
<j:set var="errorCount"><x:expr select="count($file/violation)"/></j:set>
|
|
|
|
<j:if test="${errorCount != 0}">
|
|
<tr>
|
|
<td>
|
|
<a href="#${name}">${name}</a>
|
|
</td>
|
|
<td><doc:formatAsNumber string="${errorCount}" pattern="0"/></td>
|
|
</tr>
|
|
</j:if>
|
|
</j:forEach>
|
|
</table>
|
|
|
|
<j:forEach var="file" items="${files}">
|
|
<x:set var="errorCount" select="count($file/violation)"/>
|
|
<j:if test="${errorCount != 0}">
|
|
<j:set var="name" value="${file.attribute('name').getValue()}"/>
|
|
<j:set var="name" value="${name.substring(mavenTool.toInteger(srcDirLength.toString()))}"/>
|
|
<util:replace var="name" value="${name}" oldChar="\\" newChar="/"/>
|
|
|
|
<subsection name="${name}">
|
|
<table>
|
|
<tr>
|
|
<th>Violation</th>
|
|
<th>Line</th>
|
|
</tr>
|
|
<x:set var="errors" select="$file/violation"/>
|
|
<j:forEach var="error" items="${errors}">
|
|
<tr>
|
|
<td>
|
|
<j:set var="errorMessage" value="${error.StringValue}"/>
|
|
${htmlescape.getText(errorMessage)}
|
|
</td>
|
|
<td>
|
|
<j:set var="line" value="${error.attribute('line').getValue()}"/>
|
|
<j:set var="lastIndex" value="${name.lastIndexOf('.java')}"/>
|
|
<j:choose>
|
|
<j:when test="${lastIndex > 0}">
|
|
<j:set var="index" value="${mavenTool.toInteger(lastIndex.toString())}"/>
|
|
<j:set var="nameWithoutJavaExtension" value="${name.substring(0, index)}"/>
|
|
<util:replace var="nameWithoutJavaExtension" value="${nameWithoutJavaExtension}" oldChar="\\" newChar="/"/>
|
|
<a href="xref/${nameWithoutJavaExtension}.html#${line}">${line}</a>
|
|
</j:when>
|
|
<j:otherwise>
|
|
${line}
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</td>
|
|
</tr>
|
|
</j:forEach>
|
|
</table>
|
|
</subsection>
|
|
</j:if>
|
|
</j:forEach>
|
|
</section>
|
|
</body>
|
|
</document>
|
|
</jsl:template>
|
|
</jsl:stylesheet>
|