git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@209890 13f79535-47bb-0310-9956-ffa450edef68
145 lines
6.2 KiB
XML
Executable File
145 lines
6.2 KiB
XML
Executable File
<?xml version="1.0"?>
|
|
|
|
<!--
|
|
* ========================================================================
|
|
*
|
|
* Copyright 2004 The Apache Software Foundation.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*
|
|
* ========================================================================
|
|
-->
|
|
|
|
<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.util.MavenTool"/>
|
|
<j:useBean var="fileutil" class="org.apache.velocity.texen.util.FileUtil"/>
|
|
|
|
<jsl:template match="simian">
|
|
<document>
|
|
|
|
<properties>
|
|
<author email="qalab@objectlab.co.uk">Benoit Xhenseval</author>
|
|
<title>Simian Results</title>
|
|
</properties>
|
|
|
|
<body>
|
|
<section name="Simian Results">
|
|
<p>
|
|
The following document contains the results of
|
|
<a href="http://www.redhillconsulting.com.au/products/simian/index.html">Simian <x:expr select="./@version"/></a>.</p>
|
|
</section>
|
|
|
|
<section name="Summary">
|
|
<table summary="Simian report summary">
|
|
<tbody>
|
|
<tr>
|
|
<th>Similarity threshold (lines)</th>
|
|
<td><x:expr select="./check/@threshold"/></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Total number of duplicate lines</th>
|
|
<td><x:expr select="./check/summary/@duplicateLineCount"/></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Total number of duplicate blocks</th>
|
|
<td><x:expr select="./check/summary/@duplicateBlockCount"/></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Total number of files with duplicates</th>
|
|
<td><x:expr select="./check/summary/@duplicateFileCount"/></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Total number of processed lines</th>
|
|
<td><x:expr select="./check/summary/@totalSignificantLineCount"/></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Total number of processed files</th>
|
|
<td><x:expr select="./check/summary/@totalFileCount"/></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Scan time</th>
|
|
<td><x:expr select="./check/summary/@processingTime"/> ms.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
</section>
|
|
<section name="Duplications">
|
|
<j:set var="fullSrcDir" value="${pom.build.sourceDirectory}"/>
|
|
<j:set var="fullTestSrcDir" value="${pom.build.unitTestSourceDirectory}"/>
|
|
<j:set var="srcDir" value="${fileutil.file(fullSrcDir).getCanonicalPath()}"/>
|
|
<j:set var="testDir" value="${fileutil.file(fullTestSrcDir).getCanonicalPath()}"/>
|
|
<x:set var="sets" select="./check/set"/>
|
|
<j:forEach var="duplication" items="${sets}">
|
|
<subsection name="Duplication: ${duplication.attribute('lineCount').getValue()} lines">
|
|
<x:set var="blocks" select="$duplication/block"/>
|
|
<ul>
|
|
<j:forEach var="duplicationArea" items="${blocks}">
|
|
<j:set var="name" value="${duplicationArea.attribute('sourceFile').getValue()}"/>
|
|
<j:set var="srcDirLength" value="${srcDir.length() + 1}"/>
|
|
<j:set var="testDirLength" value="${testDir.length() + 1}"/>
|
|
<j:set var="testIndex" value="${name.lastIndexOf(testDir)}"/>
|
|
<j:choose>
|
|
<j:when test="${testIndex > 0}">
|
|
<j:set var="name" value="${name.substring(mavenTool.toInteger(testDirLength.toString()))}"/>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<j:set var="name" value="${name.substring(mavenTool.toInteger(srcDirLength.toString()))}"/>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
<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="/"/>
|
|
<j:choose>
|
|
<j:when test="${testIndex > 0}">
|
|
<li><a href="xref/${nameWithoutJavaExtension}.html#${duplicationArea.attribute('startLineNumber').getValue()}">${nameWithoutJavaExtension} ( ${duplicationArea.attribute('startLineNumber').getValue()} - ${duplicationArea.attribute('endLineNumber').getValue()} )</a></li>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<li><a href="xref-test/${nameWithoutJavaExtension}.html#${duplicationArea.attribute('startLineNumber').getValue()}">${nameWithoutJavaExtension} ( ${duplicationArea.attribute('startLineNumber').getValue()} - ${duplicationArea.attribute('endLineNumber').getValue()} )</a></li>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<j:choose>
|
|
<j:when test="${testIndex > 0}">
|
|
<li><a href="xref/${name}.html#${duplicationArea.attribute('startLineNumber').getValue()}">${nameWithoutJavaExtension} ( ${duplicationArea.attribute('startLineNumber').getValue()} - ${duplicationArea.attribute('endLineNumber').getValue()} )</a></li>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<li><a href="xref-test/${name}.html#${duplicationArea.attribute('startLineNumber').getValue()}">${nameWithoutJavaExtension} ( ${duplicationArea.attribute('startLineNumber').getValue()} - ${duplicationArea.attribute('endLineNumber').getValue()} )</a></li>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</j:forEach>
|
|
</ul>
|
|
</subsection>
|
|
</j:forEach>
|
|
</section>
|
|
</body>
|
|
</document>
|
|
</jsl:template>
|
|
</jsl:stylesheet>
|