forked from phoedos/pmd
Added David Corley's Javascript report, more details are here: http://tomcopeland.blogs.com/juniordeveloper/2005/12/demo_of_some_ni.html
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4062 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -20,6 +20,7 @@ Modified renderers to support disabling printing of suppressed warnings. Introd
|
||||
Added current CLASSPATH to pmd.bat.
|
||||
UnusedFormalParameter now catches unused constructor parameters, and its warning message now reflects whether it caught a method or a constructor param.
|
||||
Rebuilt JavaCC parser with JavaCC 4.0beta1.
|
||||
Added David Corley's Javascript report, more details are here: http://tomcopeland.blogs.com/juniordeveloper/2005/12/demo_of_some_ni.html
|
||||
TODO: Removed old-style CPD command line options that were deprecated in 3.4.
|
||||
|
||||
November 30, 2005 - 3.4:
|
||||
|
BIN
pmd/etc/xslt/arrow_down.gif
Normal file
BIN
pmd/etc/xslt/arrow_down.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 131 B |
BIN
pmd/etc/xslt/arrow_up.gif
Normal file
BIN
pmd/etc/xslt/arrow_up.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 130 B |
137
pmd/etc/xslt/corley-pmd-report.xslt
Normal file
137
pmd/etc/xslt/corley-pmd-report.xslt
Normal file
@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- $Header$ -->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/html4/loose.dtd" indent="yes"/>
|
||||
|
||||
<xsl:template name="message">
|
||||
<xsl:value-of disable-output-escaping="yes" select="."/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="priorityDiv">
|
||||
<xsl:if test="@priority = 1">p1</xsl:if>
|
||||
<xsl:if test="@priority = 2">p2</xsl:if>
|
||||
<xsl:if test="@priority = 3">p3</xsl:if>
|
||||
<xsl:if test="@priority = 4">p4</xsl:if>
|
||||
<xsl:if test="@priority = 5">p5</xsl:if>
|
||||
<xsl:if test="@priority = 6">p6</xsl:if>
|
||||
<xsl:if test="@priority = 7">p7</xsl:if>
|
||||
<xsl:if test="@priority = 8">p8</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="timestamp">
|
||||
<xsl:value-of select="substring-before(//pmd/@timestamp, 'T')"/> - <xsl:value-of select="substring-before(substring-after(//pmd/@timestamp, 'T'), '.')"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="pmd">
|
||||
<html>
|
||||
<head>
|
||||
<title>PMD <xsl:value-of select="//pmd/@version"/> Report</title>
|
||||
<script type="text/javascript" src="fcoltable.js"></script>
|
||||
<style type="text/css">
|
||||
@import "fcoltable.css";
|
||||
body { margin-left: 2%; margin-right: 2%; font:normal verdana,arial,helvetica; color:#000000; }
|
||||
table.sortable tr th { font-weight: bold; text-align:left; background:#a6caf0; }
|
||||
table.sortable tr td { background:#eeeee0; }
|
||||
table.classcount tr th { font-weight: bold; text-align:left; background:#a6caf0; }
|
||||
table.classcount tr td { background:#eeeee0; }
|
||||
table.summary tr th { font-weight: bold; text-align:left; background:#a6caf0; }
|
||||
table.summary tr td { background:#eeeee0; text-align:center;}
|
||||
.p1 { background:#FF3300; }
|
||||
.p2 { background:#FF9966; }
|
||||
.p3 { background:#FFCC33; }
|
||||
.p4 { background:#FFFF00; }
|
||||
.p5 { background:#FFFFCC; }
|
||||
.p6 { background:#CCFFCC; }
|
||||
.p7 { background:#66FF66; }
|
||||
.p8 { background:#00FF00; }
|
||||
div.top{text-align:right;margin:1em 0;padding:0}
|
||||
div.top div{display:inline;white-space:nowrap}
|
||||
div.top div.left{float:left}
|
||||
#content>div.top{display:table;width:100%}
|
||||
#content>div.top div{display:table-cell}
|
||||
#content>div.top div.left{float:none;text-align:left}
|
||||
#content>div.top div.right{text-align:right}
|
||||
#topbar{
|
||||
position:absolute;
|
||||
border: 1px solid black;
|
||||
padding: 2px;
|
||||
background-color: lightyellow;
|
||||
width: 620px;
|
||||
visibility: hidden;
|
||||
z-index: 100;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="../../Common/floatmenu.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<H1><div class="top"><div class="left">PMD <xsl:value-of select="//pmd/@version"/> Report</div><div class="right"><xsl:call-template name="timestamp"/></div></div></H1>
|
||||
<hr/>
|
||||
<h2>Summary</h2>
|
||||
<table border="0" class="summary">
|
||||
<tr>
|
||||
<th>Files</th>
|
||||
<th>Total</th>
|
||||
<th>QRank Level 1</th>
|
||||
<th>QRank Level 2</th>
|
||||
<th>QRank Level 3</th>
|
||||
<th>QRank Level 4</th>
|
||||
<th>QRank Level 5</th>
|
||||
<th>QRank Level 6</th>
|
||||
<th>QRank Level 7</th>
|
||||
<th>QRank Level 8</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><xsl:value-of select="count(//file)"/></td>
|
||||
<td><xsl:value-of select="count(//violation)"/></td>
|
||||
<td><div class="p1"><xsl:value-of select="count(//violation[@priority = 1])"/></div></td>
|
||||
<td><div class="p2"><xsl:value-of select="count(//violation[@priority = 2])"/></div></td>
|
||||
<td><div class="p3"><xsl:value-of select="count(//violation[@priority = 3])"/></div></td>
|
||||
<td><div class="p4"><xsl:value-of select="count(//violation[@priority = 4])"/></div></td>
|
||||
<td><div class="p5"><xsl:value-of select="count(//violation[@priority = 5])"/></div></td>
|
||||
<td><div class="p6"><xsl:value-of select="count(//violation[@priority = 6])"/></div></td>
|
||||
<td><div class="p7"><xsl:value-of select="count(//violation[@priority = 7])"/></div></td>
|
||||
<td><div class="p8"><xsl:value-of select="count(//violation[@priority = 8])"/></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr/>
|
||||
<xsl:for-each select="file">
|
||||
<xsl:sort data-type="number" order="descending" select="count(violation)"/>
|
||||
<xsl:variable name="filename" select="@name"/>
|
||||
<H3><xsl:value-of disable-output-escaping="yes" select="substring-before(translate(@name,'/','.'),'.java')"/></H3>
|
||||
<table border="0" width="100%" class="footcollapse"><xsl:attribute name="id">sortable_id_<xsl:value-of select="position()"/></xsl:attribute>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Prio</th>
|
||||
<th>Line</th>
|
||||
<th>Method</th>
|
||||
<th align="left">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="3">Total number of violations for this class: <xsl:value-of select="count(violation)"/> (Click anywhere on this row to see/hide details)</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<xsl:for-each select="violation">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 3px" align="right"><div><xsl:attribute name="class"><xsl:call-template name="priorityDiv"/></xsl:attribute><xsl:value-of disable-output-escaping="yes" select="@priority"/></div></td>
|
||||
<td style="padding: 3px" align="right"><xsl:value-of disable-output-escaping="yes" select="@line"/></td>
|
||||
<td style="padding: 3px" align="left"><xsl:value-of disable-output-escaping="yes" select="@method"/></td>
|
||||
<td style="padding: 3px" align="left" width="100%"><xsl:if test="@externalInfoUrl"><a><xsl:attribute name="href"><xsl:value-of select="@externalInfoUrl"/></xsl:attribute><xsl:call-template name="message"/></a></xsl:if><xsl:if test="not(@externalInfoUrl)"><xsl:call-template name="message"/></xsl:if></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
<br/>
|
||||
</xsl:for-each>
|
||||
<p>Generated by <a href="http://pmd.sourceforge.net">PMD <b><xsl:value-of select="//pmd/@version"/></b></a> on <xsl:call-template name="timestamp"/>.</p>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
75
pmd/etc/xslt/fcoltable.css
Normal file
75
pmd/etc/xslt/fcoltable.css
Normal file
@ -0,0 +1,75 @@
|
||||
body{
|
||||
font-family:Arial,Sans-Serif;
|
||||
font-size:90%;
|
||||
background:#cc9;
|
||||
}
|
||||
#boundary{
|
||||
background:#f8f8f8;
|
||||
padding:2em;
|
||||
width:40em;
|
||||
}
|
||||
h1{
|
||||
font-family:"Trebuchet MS",Sans-serif;
|
||||
text-transform:uppercase;
|
||||
color:#696;
|
||||
font-size:120%;
|
||||
}
|
||||
|
||||
table.footcollapse{
|
||||
width:100%;
|
||||
}
|
||||
table.footcollapse caption{
|
||||
font-size:120%;
|
||||
text-transform:uppercase;
|
||||
text-align:left;
|
||||
padding:.5em 1em;
|
||||
}
|
||||
table.footcollapse th{
|
||||
text-align:left;
|
||||
}
|
||||
table.footcollapse,table.footcollapse th,table.footcollapse th
|
||||
{
|
||||
border:none;
|
||||
border-collapse:collapse;
|
||||
}
|
||||
table.footcollapse thead th
|
||||
{
|
||||
width:10em;
|
||||
border-style:solid;
|
||||
border-width:1px;
|
||||
border-color:#cff #69c #69c #cff;
|
||||
background:#9cf;
|
||||
padding:2px 10px;
|
||||
}
|
||||
table.footcollapse tfoot th,
|
||||
table.footcollapse tfoot td
|
||||
{
|
||||
border-style:solid;
|
||||
border-width:1px;
|
||||
border-color:#9cf #369 #369 #9cf;
|
||||
background:#69c;
|
||||
padding:2px 10px;
|
||||
}
|
||||
table.footcollapse tbody{
|
||||
background:#ddd;
|
||||
}
|
||||
table.footcollapse tbody td{
|
||||
padding:5px 10px;
|
||||
border:1px solid #999;
|
||||
}
|
||||
table.footcollapse tbody th{
|
||||
padding:2px 10px;
|
||||
border:1px solid #999;
|
||||
border-left:none;
|
||||
}
|
||||
table.footcollapse tbody tr.odd{
|
||||
background:#ccc;
|
||||
}
|
||||
|
||||
table.footcollapse tfoot td img{
|
||||
border:none;
|
||||
vertical-align:bottom;
|
||||
padding-left:10px;
|
||||
float:right;
|
||||
}
|
||||
|
57
pmd/etc/xslt/fcoltable.js
Normal file
57
pmd/etc/xslt/fcoltable.js
Normal file
@ -0,0 +1,57 @@
|
||||
function tablecollapse()
|
||||
{
|
||||
/* Variables */
|
||||
var collapseClass='footcollapse';
|
||||
var collapsePic='arrow_up.gif';
|
||||
var expandPic='arrow_down.gif';
|
||||
var initialCollapse=true;
|
||||
|
||||
// loop through all tables
|
||||
var t=document.getElementsByTagName('table');
|
||||
var checktest= new RegExp("(^|\\s)" + collapseClass + "(\\s|$)");
|
||||
for (var i=0;i<t.length;i++)
|
||||
{
|
||||
// if the table has not the right class, skip it
|
||||
if(!checktest.test(t[i].className)){continue;}
|
||||
|
||||
// make the footer clickable
|
||||
t[i].getElementsByTagName('tfoot')[0].onclick=function()
|
||||
{
|
||||
// loop through all bodies of this table and show or hide
|
||||
// them
|
||||
var tb=this.parentNode.getElementsByTagName('tbody');
|
||||
for(var i=0;i<tb.length;i++)
|
||||
{
|
||||
tb[i].style.display=tb[i].style.display=='none'?'':'none';
|
||||
}
|
||||
// change the image accordingly
|
||||
var li=this.getElementsByTagName('img')[0];
|
||||
li.src=li.src.indexOf(collapsePic)==-1?collapsePic:expandPic;
|
||||
}
|
||||
// if the bodies should be collapsed initially, do so
|
||||
if(initialCollapse)
|
||||
{
|
||||
var tb=t[i].getElementsByTagName('tbody');
|
||||
for(var j=0;j<tb.length;j++)
|
||||
{
|
||||
tb[j].style.display='none';
|
||||
}
|
||||
}
|
||||
// add the image surrounded by a dummy link to allow keyboard
|
||||
// access to the last cell in the footer
|
||||
var newa=document.createElement('a');
|
||||
newa.href='#';
|
||||
newa.onclick=function(){return false;}
|
||||
var newimg=document.createElement('img');
|
||||
newimg.src=initialCollapse?expandPic:collapsePic;
|
||||
var tf=t[i].getElementsByTagName('tfoot')[0];
|
||||
var lt=tf.getElementsByTagName('td')[tf.getElementsByTagName('td').length-1];
|
||||
newa.appendChild(newimg);
|
||||
lt.insertBefore(newa,lt.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// run tablecollapse when the page loads
|
||||
window.onload=tablecollapse;
|
||||
|
@ -45,6 +45,7 @@
|
||||
</subsection>
|
||||
<subsection name="Contributors">
|
||||
<ul>
|
||||
<li>David Corley - Nifty Javascript folding for XML report, <a href="http://tomcopeland.blogs.com/juniordeveloper/2005/12/demo_of_some_ni.html">demo is here</a></li>
|
||||
<li>George Sexton - Bug report 1379701 for CompareObjectsWithEquals, suggested new rule for Additional String Concatenation Warnings in StringBuffer.</li>
|
||||
<li>Didier Duquennoy - several bug reports for InefficientStringBuffering, bug report for ImmutableField, suggestions for improving Benchmark utility, bug report for InefficientStringBuffering, bug report for AvoidConcateningNonLiteralsInStringBuffer, reported a missed hit for EqualsNull, bug report for MissingStaticMethodInNonInstantiatableClass, pmd-netbeans feedback</li>
|
||||
<li>Johan Stuyts - improvements to UncommentedEmptyConstructor, nice patch for UncommentedEmptyConstructor and UncommentedEmptyMethod, patch to allow empty catch blocks with comments in them, patch to clean up build environment</li>
|
||||
|
Reference in New Issue
Block a user