diff options
Diffstat (limited to 'lib/findbugs')
20 files changed, 2259 insertions, 821 deletions
diff --git a/lib/findbugs/lib/annotations.jar b/lib/findbugs/lib/annotations.jar Binary files differnew file mode 100644 index 0000000..e16db1f --- /dev/null +++ b/lib/findbugs/lib/annotations.jar diff --git a/lib/findbugs/lib/asm-3.0.jar b/lib/findbugs/lib/asm-3.0.jar Binary files differnew file mode 100644 index 0000000..7a5c727 --- /dev/null +++ b/lib/findbugs/lib/asm-3.0.jar diff --git a/lib/findbugs/lib/asm-analysis-3.0.jar b/lib/findbugs/lib/asm-analysis-3.0.jar Binary files differnew file mode 100644 index 0000000..c5f795f --- /dev/null +++ b/lib/findbugs/lib/asm-analysis-3.0.jar diff --git a/lib/findbugs/lib/asm-commons-3.0.jar b/lib/findbugs/lib/asm-commons-3.0.jar Binary files differnew file mode 100644 index 0000000..2971530 --- /dev/null +++ b/lib/findbugs/lib/asm-commons-3.0.jar diff --git a/lib/findbugs/lib/asm-tree-3.0.jar b/lib/findbugs/lib/asm-tree-3.0.jar Binary files differnew file mode 100644 index 0000000..c6347fe --- /dev/null +++ b/lib/findbugs/lib/asm-tree-3.0.jar diff --git a/lib/findbugs/lib/asm-util-3.0.jar b/lib/findbugs/lib/asm-util-3.0.jar Binary files differnew file mode 100644 index 0000000..9515986 --- /dev/null +++ b/lib/findbugs/lib/asm-util-3.0.jar diff --git a/lib/findbugs/lib/asm-xml-3.0.jar b/lib/findbugs/lib/asm-xml-3.0.jar Binary files differnew file mode 100644 index 0000000..b3d1a64 --- /dev/null +++ b/lib/findbugs/lib/asm-xml-3.0.jar diff --git a/lib/findbugs/lib/bcel.jar b/lib/findbugs/lib/bcel.jar Binary files differnew file mode 100644 index 0000000..be093c8 --- /dev/null +++ b/lib/findbugs/lib/bcel.jar diff --git a/lib/findbugs/lib/buggy.icns b/lib/findbugs/lib/buggy.icns Binary files differnew file mode 100644 index 0000000..b1f4660 --- /dev/null +++ b/lib/findbugs/lib/buggy.icns diff --git a/lib/findbugs/lib/dom4j-full.jar b/lib/findbugs/lib/dom4j-full.jar Binary files differnew file mode 100644 index 0000000..1efbf7e --- /dev/null +++ b/lib/findbugs/lib/dom4j-full.jar diff --git a/lib/findbugs/lib/findbugs-ant.jar b/lib/findbugs/lib/findbugs-ant.jar Binary files differnew file mode 100644 index 0000000..3a2740e --- /dev/null +++ b/lib/findbugs/lib/findbugs-ant.jar diff --git a/lib/findbugs/lib/findbugs.jar b/lib/findbugs/lib/findbugs.jar Binary files differnew file mode 100644 index 0000000..10c8f78 --- /dev/null +++ b/lib/findbugs/lib/findbugs.jar diff --git a/lib/findbugs/lib/findbugsGUI.jar b/lib/findbugs/lib/findbugsGUI.jar Binary files differnew file mode 100644 index 0000000..8cf6984 --- /dev/null +++ b/lib/findbugs/lib/findbugsGUI.jar diff --git a/lib/findbugs/lib/jsr305.jar b/lib/findbugs/lib/jsr305.jar Binary files differnew file mode 100644 index 0000000..90119cb --- /dev/null +++ b/lib/findbugs/lib/jsr305.jar diff --git a/lib/findbugs/plugin/coreplugin.jar b/lib/findbugs/plugin/coreplugin.jar Binary files differindex 813d2b8..0f9c317 100644 --- a/lib/findbugs/plugin/coreplugin.jar +++ b/lib/findbugs/plugin/coreplugin.jar diff --git a/lib/findbugs/xsl/default.xsl b/lib/findbugs/xsl/default.xsl index efa2307..e8f30d4 100644 --- a/lib/findbugs/xsl/default.xsl +++ b/lib/findbugs/xsl/default.xsl @@ -49,11 +49,11 @@ <xsl:output method="xml" + indent="yes" omit-xml-declaration="yes" standalone="yes" + doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" - doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" - indent="yes" encoding="UTF-8"/> <xsl:variable name="literalNbsp">&nbsp;</xsl:variable> @@ -62,7 +62,7 @@ <xsl:variable name="bugTableHeader"> <tr class="tableheader"> - <th align="left">Code<xsl:value-of select="$literalNbsp" disable-output-escaping="yes"/></th> + <th align="left">Code</th> <th align="left">Warning</th> </tr> </xsl:variable> @@ -137,11 +137,14 @@ <body> - <h1>FindBugs Report</h1> + <h1><a href="http://findbugs.sourceforge.net">FindBugs</a> Report</h1> <h2>Project Information</h2> <xsl:apply-templates select="/BugCollection/Project"/> + <h2>Metrics</h2> + <xsl:apply-templates select="/BugCollection/FindBugsSummary"/> + <h2>Contents</h2> <ul> <xsl:for-each select="$unique-catkey"> @@ -174,7 +177,7 @@ <tr class="{$styleclass}"> <td><a href="#Warnings_{$catkey}"><xsl:value-of select="$catdesc"/> Warnings</a></td> - <td align="right"><xsl:value-of select="count(/BugCollection/BugInstance[@category=$catkey])"/></td> + <td align="right"><xsl:value-of select="count(/BugCollection/BugInstance[(@category=$catkey) and not(@last)])"/></td> </tr> </xsl:for-each> @@ -185,7 +188,7 @@ </xsl:variable> <tr class="{$styleclass}"> <td><b>Total</b></td> - <td align="right"><b><xsl:value-of select="count(/BugCollection/BugInstance)"/></b></td> + <td align="right"><b><xsl:value-of select="count(/BugCollection/BugInstance[not(@last)])"/></b></td> </tr> </table> @@ -199,7 +202,7 @@ <xsl:variable name="catdesc" select="/BugCollection/BugCategory[@category=$catkey]/Description"/> <xsl:call-template name="generateWarningTable"> - <xsl:with-param name="warningSet" select="/BugCollection/BugInstance[@category=$catkey]"/> + <xsl:with-param name="warningSet" select="/BugCollection/BugInstance[(@category=$catkey) and not(@last)]"/> <xsl:with-param name="sectionTitle"><xsl:value-of select="$catdesc"/> Warnings</xsl:with-param> <xsl:with-param name="sectionId">Warnings_<xsl:value-of select="$catkey"/></xsl:with-param> </xsl:call-template> @@ -217,7 +220,12 @@ </xsl:template> <xsl:template match="Project"> - <p>Project: <xsl:value-of select="@filename"/></p> + <p>Project: + <xsl:choose> + <xsl:when test='string-length(/BugCollection/Project/@projectName)>0'><xsl:value-of select="/BugCollection/Project/@projectName" /></xsl:when> + <xsl:otherwise><xsl:value-of select="/BugCollection/Project/@filename" /></xsl:otherwise> + </xsl:choose> + </p> <p>FindBugs version: <xsl:value-of select="/BugCollection/@version"/></p> <p>Code analyzed:</p> @@ -226,9 +234,10 @@ <li><xsl:value-of select="text()"/></li> </xsl:for-each> </ul> + <p><br/><br/></p> </xsl:template> -<xsl:template match="BugInstance"> +<xsl:template match="BugInstance[not(@last)]"> <xsl:variable name="warningId"><xsl:value-of select="generate-id()"/></xsl:variable> <tr class="tablerow{position() mod 2}" onclick="toggleRow('{$warningId}');"> @@ -252,7 +261,7 @@ <p id="{$warningId}" style="display: none;"> <a href="#{@type}">Bug type <xsl:value-of select="@type"/> (click for details)</a> <xsl:for-each select="./*/Message"> - <br/><xsl:value-of select="text()"/> + <br/><xsl:value-of select="text()" disable-output-escaping="no"/> </xsl:for-each> </p> </td> @@ -279,6 +288,89 @@ </table> </xsl:template> +<xsl:template match="FindBugsSummary"> + <xsl:variable name="kloc" select="@total_size div 1000.0"/> + <xsl:variable name="format" select="'#######0.00'"/> + + <p><xsl:value-of select="@total_size"/> lines of code analyzed, + in <xsl:value-of select="@total_classes"/> classes, + in <xsl:value-of select="@num_packages"/> packages.</p> + <table width="500" cellpadding="5" cellspacing="2"> + <tr class="tableheader"> + <th align="left">Metric</th> + <th align="right">Total</th> + <th align="right">Density*</th> + </tr> + <tr class="tablerow0"> + <td>High Priority Warnings</td> + <td align="right"><xsl:value-of select="@priority_1"/></td> + <td align="right"> + <xsl:choose> + <xsl:when test= "number($kloc) > 0.0 and number(@priority_1) > 0.0"> + <xsl:value-of select="format-number(@priority_1 div $kloc, $format)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="format-number(0.0, $format)"/> + </xsl:otherwise> + </xsl:choose> + </td> + </tr> + <tr class="tablerow1"> + <td>Medium Priority Warnings</td> + <td align="right"><xsl:value-of select="@priority_2"/></td> + <td align="right"> + <xsl:choose> + <xsl:when test= "number($kloc) > 0.0 and number(@priority_2) > 0.0"> + <xsl:value-of select="format-number(@priority_2 div $kloc, $format)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="format-number(0.0, $format)"/> + </xsl:otherwise> + </xsl:choose> + </td> + </tr> + + <xsl:choose> + <xsl:when test="@priority_3"> + <tr class="tablerow1"> + <td>Low Priority Warnings</td> + <td align="right"><xsl:value-of select="@priority_3"/></td> + <td align="right"> + <xsl:choose> + <xsl:when test= "number($kloc) > 0.0 and number(@priority_3) > 0.0"> + <xsl:value-of select="format-number(@priority_3 div $kloc, $format)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="format-number(0.0, $format)"/> + </xsl:otherwise> + </xsl:choose> + </td> + </tr> + <xsl:variable name="totalClass" select="tablerow0"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="totalClass" select="tablerow1"/> + </xsl:otherwise> + </xsl:choose> + + <tr class="$totalClass"> + <td><b>Total Warnings</b></td> + <td align="right"><b><xsl:value-of select="@total_bugs"/></b></td> + <xsl:choose> + <xsl:when test="number($kloc) > 0.0"> + <td align="right"><b><xsl:value-of select="format-number(@total_bugs div $kloc, $format)"/></b></td> + </xsl:when> + <xsl:otherwise> + <td align="right"><b><xsl:value-of select="format-number(0.0, $format)"/></b></td> + </xsl:otherwise> + </xsl:choose> + </tr> + </table> + <p><i>(* Defects per Thousand lines of non-commenting source statements)</i></p> + <p><br/><br/></p> + +</xsl:template> + </xsl:stylesheet> <!-- vim:set ts=4: --> diff --git a/lib/findbugs/xsl/fancy-hist.xsl b/lib/findbugs/xsl/fancy-hist.xsl new file mode 100644 index 0000000..8086600 --- /dev/null +++ b/lib/findbugs/xsl/fancy-hist.xsl @@ -0,0 +1,1127 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Copyright (C) 2005, 2006 Etienne Giraudy, InStranet Inc + Copyright (C) 2005, 2007 Etienne Giraudy + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +--> + +<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > + <xsl:output + method="xml" indent="yes" + doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" + doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" + encoding="UTF-8"/> + + <xsl:variable name="apos" select=""'""/> + <xsl:key name="lbc-code-key" match="/BugCollection/BugInstance" use="concat(@category,@abbrev)" /> + <xsl:key name="lbc-bug-key" match="/BugCollection/BugInstance" use="concat(@category,@abbrev,@type)" /> + <xsl:key name="lbp-class-b-t" match="/BugCollection/BugInstance" use="concat(Class/@classname,@type)" /> + +<xsl:template match="/" > + +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <title> + FindBugs (<xsl:value-of select="/BugCollection/@version" />) + Analysis for + <xsl:choose> + <xsl:when test='string-length(/BugCollection/Project/@projectName)>0'><xsl:value-of select="/BugCollection/Project/@projectName" /></xsl:when> + <xsl:otherwise><xsl:value-of select="/BugCollection/Project/@filename" /></xsl:otherwise> + </xsl:choose> + </title> + <style type="text/css"> + html, body, div, form { + margin:0px; + padding:0px; + } + body { + padding:3px; + } + a, a:link , a:active, a:visited, a:hover { + text-decoration: none; color: black; + } + #navlist { + padding: 3px 0; + margin-left: 0; + border-bottom: 1px solid #778; + font: bold 12px Verdana, sans-serif; + } + #navlist li { + list-style: none; + margin: 0; + display: inline; + } + #navlist li a { + padding: 3px 0.5em; + margin-left: 3px; + border: 1px solid #778; + border-bottom: none; + background: #DDE; + text-decoration: none; + } + #navlist li a:link { color: #448; } + #navlist li a:visited { color: #667; } + #navlist li a:hover { + color: #000; + background: #AAE; + border-color: #227; + } + #navlist li a.current { + background: white; + border-bottom: 1px solid white; + } + #filterWrapper { + margin-bottom:5px; + } + #displayWrapper { + margin-top:5px; + } + .message { + background:#BBBBBB; + border: 1px solid #778; + } + .displayContainer { + border:1px solid #555555; + margin-top:3px; + padding: 3px; + display:none; + } + #summaryContainer table, + #historyContainer table { + border:1px solid black; + } + #summaryContainer th, + #historyContainer th { + background: #aaaaaa; + color: white; + } + #summaryContainer th, #summaryContainer td, + #historyContainer th, #historyContainer td { + padding: 2px 4px 2px 4px; + } + .summary-name { + background: #eeeeee; + text-align:left; + } + .summary-size { + background: #eeeeee; + text-align:center; + } + .summary-priority-all { + background: #dddddd; + text-align:center; + } + .summary-priority-1 { + background: red; + text-align:center; + } + .summary-priority-2 { + background: orange; + text-align:center; + } + .summary-priority-3 { + background: green; + text-align:center; + } + .summary-priority-4 { + background: blue; + text-align:center; + } + + .bugList-level1 { + margin-bottom:5px; + } + .bugList-level1, .bugList-level2, .bugList-level3, .bugList-level4 { + background-color: #ffffff; + margin-left:15px; + padding-left:10px; + } + .bugList-level1-label, .bugList-level2-label, .bugList-level3-label, .bugList-level4-label { + background-color: #bbbbbb; + border: 1px solid black; + padding: 1px 3px 1px 3px;; + } + .bugList-level2-label, .bugList-level3-label, .bugList-level4-label { + border-width: 0px 1px 1px 1px; + } + .bugList-level4-label { + background-color: #ffffff; + border: 0px 0px 1px 0px; + } + .bugList-level4 { + border: 0px 1px 1px 1px; + } + + .bugList-level4-inner { + border-style: solid; + border-color: black; + border-width: 0px 1px 1px 1px; + } + .b-r { + font-size: 10pt; font-weight: bold; padding: 0 0 0 60px; + } + .b-d { + font-weight: normal; background: #ccccc0; + padding: 0 5px 0 5px; margin: 0px; + } + .b-1 { + background: red; height: 0.5em; width: 1em; + margin-right: 0.5em; + } + .b-2 { + background: orange; height: 0.5em; width: 1em; + margin-right: 0.5em; + } + .b-3 { + background: green; height: 0.5em; width: 1em; + margin-right: 0.5em; + } + .b-4 { + background: blue; height: 0.5em; width: 1em; + margin-right: 0.5em; + } + + </style> + <script type='text/javascript'><xsl:text disable-output-escaping='yes'><![CDATA[ + var menus = new Array('summary','info','history','listByCategories','listByPackages'); + var selectedMenuId = "summary"; + var selectedVersion = -1; + var selectedPriority = 4; + var lastVersion = 0; + + var bPackageNamesPopulated = false; + + var filterContainerId = "filterWrapper"; + var messageContainerId = "messageContainer"; + var summaryContainerId = "summaryContainer"; + var infoContainerId = "infoContainer"; + var historyContainerId = "historyContainer"; + var listByCategoriesContainerId = "listByCategoriesContainer"; + var listByPackagesContainerId = "listByPackagesContainer"; + + var idxCatKey = 0; var idxCatDescr = 1; var idxBugCat = 1; + var idxCodeKey = 0; var idxCodeDescr = 1; var idxBugCode = 2; + var idxPatternKey = 2; var idxPatternDescr = 3; var idxBugPattern = 3; + var idxBugKey = 0; var idxBugDescr = 6; + var idxBugClass = 6, idxBugPackage = 7; + + // main init function + function init() { + loadFilter(); + selectMenu(selectedMenuId); + lastVersion = versions.length - 1; + } + + // menu callback function + function selectMenu(menuId) { + document.getElementById(selectedMenuId).className="none"; + document.getElementById(menuId).className="current"; + if (menuId!=selectedMenuId) { + hideMenu(selectedMenuId); + selectedMenuId = menuId; + } + if (menuId=="summary") displaySummary(); + if (menuId=="info") displayInfo(); + if (menuId=="history") displayHistory(); + if (menuId=="listByCategories") displayListByCategories(); + if (menuId=="listByPackages") displayListByPackages(); + } + + // display filter + function loadFilter() { + var versionsBox = document.findbugsForm.versions.options; + versionsBox[0] = new Option(" -- All Versions -- ","-1"); + versionsBox.selectedIndex = 0; + if (versions.length>=1) { + for (x=0; versions.length>1 && x<versions.length; x++) { + versionsBox[x+1] = new Option(" Bugs at release: "+versions[versions.length-x-1][1], versions[versions.length-x-1][0]); + } + } + + var prioritiesBox = document.findbugsForm.priorities.options; + prioritiesBox[0] = new Option(" -- All priorities -- ", "4"); + prioritiesBox[1] = new Option(" P1 bugs ", "1"); + prioritiesBox[2] = new Option(" P1 and P2 bugs ", "2"); + prioritiesBox[3] = new Option(" P1, P2 and P3 bugs ", "3"); + } + + // display a message + function displayMessage(msg) { + var container = document.getElementById(messageContainerId); + container.innerHTML = "<div class='message'>"+msg+"</div>"; + } + + // reset displayed message + function resetMessage() { + var container = document.getElementById(messageContainerId); + container.innerHTML = ""; + } + + function hideMenu(menuId) { + var container = menuId+"Container"; + document.getElementById(container).style.display="none"; + } + + // filter callback function + function filter() { + var versionsBox = document.findbugsForm.versions.options; + selectedVersion = versionsBox[versionsBox.selectedIndex].value; + + var prioritiesBox = document.findbugsForm.priorities.options; + selectedPriority = prioritiesBox[prioritiesBox.selectedIndex].value; + + selectMenu(selectedMenuId); + } + + // display summary tab + function displaySummary() { + resetMessage(); + hide(filterContainerId); + var container = document.getElementById(summaryContainerId); + container.style.display="block"; + } + + // display info tab + function displayInfo() { + resetMessage(); + hide(filterContainerId); + var container = document.getElementById(infoContainerId); + container.style.display="block"; + } + + // display history tab + function displayHistory() { + displayMessage("Loading history..."); + hide(filterContainerId); + var container = document.getElementById(historyContainerId); + var content = ""; + var i=0; + var p = [0,0,0,0,0]; + var f = [0,0,0,0,0]; + + content += "<table><tr><th>Release</th><th>Bugs</th><th>Bugs p1</th><th>Bugs p2</th><th>Bugs p3</th><th>Bugs Exp.</th></tr>"; + + for (i=(versions.length-1); i>0; i--) { + v = countBugsVersion(i, 4); + t = countTotalBugsVersion(i); + o = countFixedButActiveBugsVersion(i); + f = countFixedBugsInVersion(i); + content += "<tr>"; + content += "<td class='summary-name'>" + versions[i][1] + "</td>"; + content += "<td class='summary-priority-all'> " + (t[0] + o[0]) + " (+" + v[0] + " / -" + f[0] + ") </td>"; + content += "<td class='summary-priority-1' > " + (t[1] + o[1]) + " (+" + v[1] + " / -" + f[1] + ") </td>"; + content += "<td class='summary-priority-2' > " + (t[2] + o[2]) + " (+" + v[2] + " / -" + f[2] + ") </td>"; + content += "<td class='summary-priority-3' > " + (t[3] + o[3]) + " (+" + v[3] + " / -" + f[3] + ") </td>"; + content += "<td class='summary-priority-4' > " + (t[4] + o[4]) + " (+" + v[4] + " / -" + f[4] + ") </td>"; + content += "</tr>"; + } + + t = countTotalBugsVersion(0); + o = countFixedButActiveBugsVersion(0); + content += "<tr>"; + content += "<td class='summary-name'>" + versions[0][1] + "</td>"; + content += "<td class='summary-priority-all'> " + (t[0] + o[0]) + " </td>"; + content += "<td class='summary-priority-1' > " + (t[1] + o[1]) + " </td>"; + content += "<td class='summary-priority-2' > " + (t[2] + o[2]) + " </td>"; + content += "<td class='summary-priority-3' > " + (t[3] + o[3]) + " </td>"; + content += "<td class='summary-priority-4' > " + (t[4] + o[4]) + " </td>"; + content += "</tr>"; + + content += "</table>"; + container.innerHTML = content; + container.style.display="block"; + resetMessage(); + } + + // display list by cat tab + function displayListByCategories() { + show(filterContainerId); + var container = document.getElementById(listByCategoriesContainerId); + container.innerHTML = ""; + container.style.display="block"; + displayMessage("Loading stats (categories)..."); + container.innerHTML = displayLevel1("lbc", "Stats by Bug Categories"); + resetMessage(); + } + + // display list by package tab + function displayListByPackages() { + show(filterContainerId); + var container = document.getElementById(listByPackagesContainerId); + container.style.display="block"; + if (!bPackageNamesPopulated) { + displayMessage("Initializing..."); + populatePackageNames(); + } + displayMessage("Loading stats (packages)..."); + container.innerHTML = displayLevel1("lbp", "Stats by Bug Package"); + resetMessage(); + } + + // callback function for list item click + function toggleList(listType, containerId, id1, id2, id3) { + var container = document.getElementById(containerId); + if (container.style.display=="block") { + container.style.display="none"; + } else { + if (listType=="lbc") { + if (id1.length>0 && id2.length==0 && id3.length==0) { + displayCategoriesCodes(containerId, id1); + } else if (id1.length>0 && id2.length>0 && id3.length==0) { + displayCategoriesCodesPatterns(containerId, id1, id2); + } else if (id1.length>0 && id2.length>0 && id3.length>0) { + displayCategoriesCodesPatternsBugs(containerId, id1, id2, id3); + } else { + // ??? + } + } else if (listType=="lbp") { + if (id1.length>0 && id2.length==0 && id3.length==0) { + displayPackageCodes(containerId, id1); + } else if (id1.length>0 && id2.length>0 && id3.length==0) { + displayPackageClassPatterns(containerId, id1, id2); + } else if (id1.length>0 && id2.length>0 && id3.length>0) { + displayPackageClassPatternsBugs(containerId, id1, id2, id3); + } else { + // ??? + } + } else { + // ???? + } + } + } + + // list by categories, display bug cat>codes + function displayCategoriesCodes(containerId, catId) { + displayMessage("Loading stats (codes)..."); + var container = document.getElementById(containerId); + container.style.display="block"; + if (container.innerHTML=="Loading..." || container.innerHTML=="") { + container.innerHTML = displayLevel2("lbc", catId); + } + resetMessage(); + } + + // list by categories, display bug package>codes + function displayPackageCodes(containerId, packageId) { + displayMessage("Loading stats (codes)..."); + var container = document.getElementById(containerId); + container.style.display="block"; + if (container.innerHTML=="Loading..." || container.innerHTML=="") { + container.innerHTML = displayLevel2("lbp", packageId); + } + resetMessage(); + } + + // list by categories, display bug cat>codes>patterns + function displayCategoriesCodesPatterns(containerId, catId, codeId) { + displayMessage("Loading stats (patterns)..."); + var container = document.getElementById(containerId); + container.style.display="block"; + if (container.innerHTML=="Loading..." || container.innerHTML=="") + container.innerHTML = displayLevel3("lbc", catId, codeId); + resetMessage(); + } + + // list by package, display bug package>class>patterns + function displayPackageClassPatterns(containerId, packageId, classId) { + displayMessage("Loading stats (patterns)..."); + var container = document.getElementById(containerId); + container.style.display="block"; + if (container.innerHTML=="Loading..." || container.innerHTML=="") + container.innerHTML = displayLevel3("lbp", packageId, classId); + resetMessage(); + } + + // list by categories, display bug cat>codes>patterns>bugs + function displayCategoriesCodesPatternsBugs(containerId, catId, codeId, patternId) { + displayMessage("Loading stats (bugs)..."); + var container = document.getElementById(containerId); + container.style.display="block"; + if (container.innerHTML=="Loading..." || container.innerHTML=="") + container.innerHTML = displayLevel4("lbc", catId, codeId, patternId); + resetMessage(); + } + + // list by package, display bug package>class>patterns>bugs + function displayPackageClassPatternsBugs(containerId, packageId, classId, patternId) { + displayMessage("Loading stats (bugs)..."); + var container = document.getElementById(containerId); + container.style.display="block"; + if (container.innerHTML=="Loading..." || container.innerHTML=="") + container.innerHTML = displayLevel4("lbp", packageId, classId, patternId); + resetMessage(); + } + + // generate level 1 list + function displayLevel1(list, title) { + var content = ""; + var content2 = ""; + + content += "<h3>"+title+"</h3>"; + content += getPriorityLegend(); + content2 += "<div class='bugList'>"; + + var id = ""; + var containerId = ""; + var subContainerId = ""; + var prefixSub = ""; + var prefixId = ""; + var p = [0,0,0,0,0]; + var numberOfBugs = 0; + var label = ""; + var max = 0; + if (list=="lbc") { + max = categories.length; + } else if (list=="lbp") { + max = packageStats.length; + } + + for (var x=0; x<max -1; x++) { + if (list=="lbp" && packageStats[x][1]=="0") continue; + + if (list=="lbc") { + id = categories[x][idxCatKey]; + label = categories[x][idxCatDescr]; + containerId = "categories-" + id; + subContainerId = "cat-"+id; + p = countBugsCat(selectedVersion, selectedPriority, id, idxBugCat); + } + if (list=="lbp") { + id = packageStats[x][0]; + label = packageStats[x][0]; + containerId = "packages-" + id; + subContainerId = "package-"+id; + p = countBugsPackage(selectedVersion, selectedPriority, id, idxBugPackage); + } + + subContainerId = prefixSub+id; + + var total = p[1]+p[2]+p[3]+p[4]; + if (total > 0) { + content2 += addListItem( 1, containerId, label, total, p, subContainerId, + "toggleList('" + list + "', '" + subContainerId + "', '"+ id + "', '', '')" + ); + } + numberOfBugs += total; + } + content2 += "</div>"; + content += "<h4>Total number of bugs"; + if (selectedVersion!=-1) { + content += " (introduced in release " + versions[selectedVersion][1] +")"; + } + content += ": "+numberOfBugs+"</h4>"; + return content+content2; + } + + // generate level 2 list + function displayLevel2(list, id1) { + var content = ""; + var code = ""; + var containerId = ""; + var subContainerId = ""; + var p = [0,0,0,0,0]; + var max = 0; + var id2 = ""; + if (list=="lbc") { + max = codes.length; + } else if (list=="lbp") { + max = classStats.length; + } + + for (var x=0; x<max -1; x++) { + if (list=="lbp" && classStats[x][3]=="0") continue; + + if (list=="lbc") { + id2 = codes[x][idxCodeKey]; + label = codes[x][idxCodeDescr]; + containerId = "codes-"+id1; + subContainerId = "cat-" + id1 + "-code-" + id2; + p = countBugsCode(selectedVersion, selectedPriority, id1, idxBugCat, id2, idxBugCode); + } + if (list=="lbp") { + id2 = classStats[x][0]; + label = classStats[x][0]; + containerId = "packages-"+id1; + subContainerId = "package-" + id1 + "-class-" + id2; + p = countBugsClass(selectedVersion, selectedPriority, id1, idxBugPackage, id2, idxBugClass); + } + + var total = p[1]+p[2]+p[3]+p[4]; + if (total > 0) { + content += addListItem( 2, containerId, label, total, p, subContainerId, + "toggleList('"+ list + "', '" + subContainerId + "', '"+ id1 + "', '"+ id2 + "', '')" + ); + } + } + return content; + } + + // generate level 3 list + function displayLevel3(list, id1, id2) { + var content = ""; + var containerId = ""; + var subContainerId = ""; + var p = [0,0,0,0,0]; + var max = 0; + var label = ""; + var id3 = ""; + + if (list=="lbc") { + max = patterns.length; + } else if (list=="lbp") { + max = patterns.length; + } + + for (var x=0; x<max -1; x++) { + //if (list=="lbp" && (patterns[x][0]!=id1 || patterns[x][1]!=id2)) continue; + //if (list=="lbp" && classStats[x][3]=="0") continue; + + if (list=="lbc") { + id3 = patterns[x][idxPatternKey];; + label = patterns[x][idxPatternDescr]; + containerId = "patterns-"+id1; + subContainerId = "cat-" + id1 + "-code-" + id2 + "-pattern-" + id3; + p = countBugsPattern(selectedVersion, selectedPriority, id1, idxBugCat, id2, idxBugCode, id3, idxBugPattern); + } + if (list=="lbp") { + id3 = patterns[x][idxPatternKey];; + label = patterns[x][idxPatternDescr]; + containerId = "classpatterns-"+id1; + subContainerId = "package-" + id1 + "-class-" + id2 + "-pattern-" + id3; + p = countBugsClassPattern(selectedVersion, selectedPriority, id2, idxBugClass, id3, idxBugPattern); + } + + var total = p[1]+p[2]+p[3]+p[4]; + if (total > 0) { + content += addListItem( 3, containerId, label, total, p, subContainerId, + "toggleList('" + list + "', '" + subContainerId + "', '"+ id1 + "', '"+ id2 + "', '"+ id3 + "')" + ); + } + } + return content; + } + + // generate level 4 list + function displayLevel4(list, id1, id2, id3) { + var content = ""; + var bug = ""; + var bugP = 0; + var containerId = ""; + var subContainerId = ""; + var bugId = ""; + var label = ""; + var p = [0,0,0,0,0]; + for (var x=0; x<bugs.length -1; x++) { + bug = bugs[x]; + if (list=="lbc") { + if ( bug[1]!=id1 || bug[2]!=id2 || bug[3]!=id3 ) continue; + if ( selectedVersion!=-1 + && selectedVersion!=bug[5]) continue; + if ( selectedPriority!=4 + && selectedPriority<bug[4]) continue; + + subContainerId = "cat-" + id1 + "-code-" + id2 + "-pattern-" + id3 + "-bug-" + bug[0]; + } + if (list=="lbp") { + if ( bug[7]!=id1 || bug[6]!=id2 || bug[3]!=id3 ) continue; + if ( selectedVersion!=-1 + && selectedVersion!=bug[5]) continue; + if ( selectedPriority!=4 + && selectedPriority<bug[4]) continue; + + subContainerId = "package-" + id1 + "-class-" + id2 + "-pattern-" + id3 + "-bug-" + bug[0]; + } + + bugId = "b-uid-" + bug[0]; + label = bug[idxBugDescr]; + containerId = "bugs-"+bugId; + bugP = bug[4]; + p[bugP]++; + var total = p[1]+p[2]+p[3]+p[4]; + if (total > 0) { + content += addBug( 4, containerId, label, bugP, bug[5], subContainerId, + "showbug('" + bugId + "', '" + subContainerId + "', '"+id3+"')"); + } + } + return content; + } + + + function addListItem(level, id, label, total, p, subId, onclick) { + var content = ""; + + content += "<div class='bugList-level"+level+"' >"; + content += "<div class='bugList-level"+level+"-label' id='"+id+"' >"; + content += "<a href='' onclick=\"" + onclick + ";return false;\" "; + content += ">"; + content += "<strong>"+label+"</strong>"; + content += " "+total+" bugs"; + if (selectedPriority>1) + content += " <em>("+p[1]; + if (selectedPriority>=2) + content += "/"+p[2]; + if (selectedPriority>=3) + content += "/"+p[3]; + if (selectedPriority>=4) + content += "/"+p[4]; + if (selectedPriority>1) + content += ")</em>"; + content += "</a>"; + content += "</div>"; + content += "<div class='bugList-level"+level+"-inner' id='"+subId+"' style='display:none;'>Loading...</div>"; + content += "</div>"; + return content; + } + + function addBug( level, id, label, p, version, subId, onclick) { + var content = ""; + + content += "<div class='bugList-level" + level + "' id='" + id + "'>"; + content += "<div class='bugList-level" + level + "-label' id='" + id + "'>"; + content += "<span class='b-" + p + "'> </span>"; + content += "<a href='' onclick=\"" + onclick + ";return false;\">"; + if (version==lastVersion) { + content += "<span style='color:red;font-weight:bold;'>NEW!</span> "; + } + content += "<strong>" + label + "</strong>"; + if (version==0) { + content += " <em>since release first historized release</em>"; + } else { + content += " <em>since release " + versions[version][1] + "</em>"; + } + content += "</a>"; + content += "</div>"; + content += "<div class='bugList-level" + level + "-inner' id='" + subId + "' style='display:none;'>Loading...</div>"; + content += "</div>"; + return content; + } + + function countBugsVersion(version, priority) { + return countBugs(version, priority, "", -1, "", -1, "", -1, "", -1, "", -1); + } + + function countBugsCat(version, priority, cat, idxCat) { + return countBugs(version, priority, cat, idxCat, "", -1, "", -1, "", -1, "", -1); + } + + function countBugsPackage(version, priority, packageId, idxPackage) { + return countBugs(version, priority, "", -1, "", -1, "", -1, packageId, idxPackage, "", -1); + } + + function countBugsCode(version, priority, cat, idxCat, code, idxCode) { + return countBugs(version, priority, cat, idxCat, code, idxCode, "", -1, "", -1, "", -1); + } + + function countBugsPattern(version, priority, cat, idxCat, code, idxCode, packageId, idxPattern) { + return countBugs(version, priority, cat, idxCat, code, idxCode, packageId, idxPattern, "", -1, "", -1); + } + + function countBugsClass(version, priority, id1, idxBugPackage, id2, idxBugClass) { + return countBugs(version, priority, "", -1, "", -1, "", -1, id1, idxBugPackage, id2, idxBugClass); + } + + function countBugsClassPattern(version, priority, id2, idxBugClass, id3, idxBugPattern) { + return countBugs(version, priority, "", -1, "", -1, id3, idxBugPattern, "", -1, id2, idxBugClass); + } + + function countBugs(version, priority, cat, idxCat, code, idxCode, pattern, idxPattern, packageId, idxPackage, classId, idxClass) { + var count = [0,0,0,0,0]; + var last=1000000; + for (var x=0; x<bugs.length-1; x++) { + var bug = bugs[x]; + + var bugCat = bug[idxCat]; + var bugP = bug[4]; + var bugCode = bug[idxCode]; + var bugPattern = bug[idxPattern]; + + if ( (version==-1 || version==bug[5]) + && (priority==4 || priority>=bug[4]) + && (idxCat==-1 || bug[idxCat]==cat) + && (idxCode==-1 || bug[idxCode]==code) + && (idxPattern==-1 || bug[idxPattern]==pattern) + && (idxPackage==-1 || bug[idxPackage]==packageId) + && (idxClass==-1 || bug[idxClass]==classId) + ) { + count[bug[4]]++; + } + } + count[0] = count[1] + count[2] + count[3] + count[4]; + return count; + } + + function countFixedBugsInVersion(version) { + var count = [0,0,0,0,0]; + var last=1000000; + for (var x=0; x<fixedBugs.length-1; x++) { + var bug = fixedBugs[x]; + + var bugP = bug[4]; + + if ( version==-1 || version==(bug[6]+1)) { + count[bug[4]]++; + } + } + count[0] = count[1] + count[2] + count[3] + count[4]; + return count; + } + + function countFixedButActiveBugsVersion(version) { + var count = [0,0,0,0,0]; + var last=1000000; + for (var x=0; x<fixedBugs.length-1; x++) { + var bug = fixedBugs[x]; + + var bugP = bug[4]; + + if ( version==-1 || (version >=bug[5] && version<=bug[6]) ) { + count[bug[4]]++; + } + } + count[0] = count[1] + count[2] + count[3] + count[4]; + return count; + } + + function countTotalBugsVersion(version) { + var count = [0,0,0,0,0]; + var last=1000000; + for (var x=0; x<bugs.length-1; x++) { + var bug = bugs[x]; + + var bugP = bug[4]; + + if (version==-1 || version>=bug[5]) { + count[bug[4]]++; + } + } + count[0] = count[1] + count[2] + count[3] + count[4]; + return count; + } + + function getPriorityLegend() { + var content = ""; + content += "<h5><span class='b-1'> </span> P1 "; + content += "<span class='b-2'> </span> P2 "; + content += "<span class='b-3'> </span> P3 "; + content += "<span class='b-4'> </span> Exp "; + content += "</h5>"; + return content; + } + + function populatePackageNames() { + for (var i=0; i<bugs.length; i++) { + var classId = bugs[i][6]; + var idx = classId.lastIndexOf('.'); + var packageId = ""; + + if (idx>0) { + packageId = classId.substring(0, idx); + } + + bugs[i][7] = packageId; + } + } + + function showbug(bugId, containerId, patternId) { + var bugplaceholder = document.getElementById(containerId); + var bug = document.getElementById(bugId); + + if ( bugplaceholder==null) { + alert(buguid+'-ph-'+list+' - '+buguid+' - bugplaceholder==null'); + return; + } + if ( bug==null) { + alert(buguid+'-ph-'+list+' - '+buguid+' - bug==null'); + return; + } + + var newBug = bug.innerHTML; + var pattern = document.getElementById('tip-'+patternId).innerHTML; + toggle(containerId); + bugplaceholder.innerHTML = newBug + pattern; + } + function toggle(foo) { + if( document.getElementById(foo).style.display == "none") { + show(foo); + } else { + if( document.getElementById(foo).style.display == "block") { + hide(foo); + } else { + show(foo); + } + } + } + function show(foo) { + document.getElementById(foo).style.display="block"; + } + function hide(foo) { + document.getElementById(foo).style.display="none"; + } + + window.onload = function(){ + init(); + }; + ]]></xsl:text></script> + <script type='text/javascript'> + // versions fields: release id, release label + var versions = new Array( + <xsl:for-each select="/BugCollection/History/AppVersion"> + [ "<xsl:value-of select="@sequence" />", "<xsl:value-of select="@release" />" ], + </xsl:for-each> + [ "<xsl:value-of select="/BugCollection/@sequence" />", "<xsl:value-of select="/BugCollection/@release" />" ] + ); + + // categories fields: category id, category label + var categories = new Array( + <xsl:for-each select="/BugCollection/BugCategory"> + <xsl:sort select="@category" order="ascending" /> + [ "<xsl:value-of select="@category" />", "<xsl:value-of select="Description" />" ], + </xsl:for-each> + [ "", "" ] + ); + + // codes fields: code id, code label + var codes = new Array( + <xsl:for-each select="/BugCollection/BugCode"> + <xsl:sort select="@abbrev" order="ascending" /> + [ "<xsl:value-of select="@abbrev" />", "<xsl:value-of select="Description" />" ], + </xsl:for-each> + [ "", "" ] + ); + + // patterns fields: category id, code id, pattern id, pattern label + var patterns = new Array( + <xsl:for-each select="/BugCollection/BugPattern"> + <xsl:sort select="@type" order="ascending" /> + [ "<xsl:value-of select="@category" />", "<xsl:value-of select="@abbrev" />", "<xsl:value-of select="@type" />", "<xsl:value-of select="translate(ShortDescription, '"', $apos)" />" ], + + </xsl:for-each> + [ "", "", "", "" ] + ); + + // class stats fields: class name, package name, isInterface, total bugs, bugs p1, bugs p2, bugs p3, bugs p4 + var classStats = new Array( + <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats/ClassStats"> + <xsl:sort select="@class" order="ascending" /> + [ "<xsl:value-of select="@class" />", "<xsl:value-of select="../@package" />", "<xsl:value-of select="@interface" />", "<xsl:value-of select="@bugs" />", "<xsl:value-of select="@priority_1" />", "<xsl:value-of select="@priority_2" />", "<xsl:value-of select="@priority_3" />", "<xsl:value-of select="@priority_4" />" ], + </xsl:for-each> + [ "", "", "", "", "", "", "", "" ] + ); + + // package stats fields: package name, total bugs, bugs p1, bugs p2, bugs p3, bugs p4 + var packageStats = new Array( + <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats"> + <xsl:sort select="@package" order="ascending" /> + [ "<xsl:value-of select="@package" />", "<xsl:value-of select="@total_bugs" />", "<xsl:value-of select="@priority_1" />", "<xsl:value-of select="@priority_2" />", "<xsl:value-of select="@priority_3" />", "<xsl:value-of select="@priority_4" />" ], + </xsl:for-each> + [ "", "", "", "", "", "" ] + ); + + + // bugs fields: bug id, category id, code id, pattern id, priority, release id, class name, packagename (populated by javascript) + var bugs = new Array( + <xsl:for-each select="/BugCollection/BugInstance[string-length(@last)=0]"> + + [ "<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" />", + "<xsl:value-of select="@category" />", + "<xsl:value-of select="@abbrev" />", + "<xsl:value-of select="@type" />", + <xsl:value-of select="@priority" />, + <xsl:choose><xsl:when test='string-length(@first)=0'>0</xsl:when><xsl:otherwise><xsl:value-of select="@first" /></xsl:otherwise></xsl:choose>, + "<xsl:value-of select="Class/@classname" />", + ""], + </xsl:for-each> + [ "", "", "", "", 0, 0, "", "" ] + ); + + // bugs fields: bug id, category id, code id, pattern id, priority, first release id, fixed release id, class name + var fixedBugs = new Array( + <xsl:for-each select="/BugCollection/BugInstance[string-length(@last)>0]"> + + [ "<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" />", + "<xsl:value-of select="@category" />", + "<xsl:value-of select="@abbrev" />", + "<xsl:value-of select="@type" />", + <xsl:value-of select="@priority" />, + <xsl:choose><xsl:when test='string-length(@first)=0'>0</xsl:when><xsl:otherwise><xsl:value-of select="@first" /></xsl:otherwise></xsl:choose>, + <xsl:choose><xsl:when test='string-length(@last)>0'><xsl:value-of select="@last" /></xsl:when><xsl:otherwise>-42</xsl:otherwise></xsl:choose>, + "<xsl:value-of select="Class/@classname" />" ], + </xsl:for-each> + [ "", "", "", "", 0, 0, 0, "" ] + ); + + </script> + </head> + <body> + <h3> + <a href="http://findbugs.sourceforge.net">FindBugs</a> (<xsl:value-of select="/BugCollection/@version" />) + Analysis for + <xsl:choose> + <xsl:when test='string-length(/BugCollection/Project/@projectName)>0'><xsl:value-of select="/BugCollection/Project/@projectName" /></xsl:when> + <xsl:otherwise><xsl:value-of select="/BugCollection/Project/@filename" /></xsl:otherwise> + </xsl:choose> + </h3> + + <div id='menuWrapper' style=''> + <div id="navcontainer"> + <ul id="navlist"> + <li><a id='summary' class="current" href="#" onclick="selectMenu('summary'); return false;" >Summary</a></li> + <li><a id='history' class="none" href="#" onclick="selectMenu('history'); return false;" >History</a></li> + <li><a id='listByCategories' class="none" href="#" onclick="selectMenu('listByCategories'); return false;">Browse By Categories</a></li> + <li><a id='listByPackages' class="none" href="#" onclick="selectMenu('listByPackages'); return false;" >Browse by Packages</a></li> + <li><a id='info' class="none" href="#" onclick="selectMenu('info'); return false;" >Info</a></li> + </ul> + </div> + </div> + + <div id='displayWrapper'> + + <div style='height:25px;'> + <div id='messageContainer' style='float:right;'> + Computing data... + </div> + <div id='filterWrapper' style='display:none;'> + <form name='findbugsForm'> + <div id='filterContainer' > + <select name='versions' onchange='filter()'> + <option value="loading">Loading filter...</option> + </select> + <select name='priorities' onchange='filter()'> + <option value="loading">Loading filter...</option> + </select> + </div> + </form> + </div> + </div> + <div id='summaryContainer' class='displayContainer'> + <h3>Package Summary</h3> + <table> + <tr> + <th>Package</th> + <th>Code Size</th> + <th>Bugs</th> + <th>Bugs p1</th> + <th>Bugs p2</th> + <th>Bugs p3</th> + <th>Bugs Exp.</th> + </tr> + <tr> + <td class='summary-name'> + Overall + (<xsl:value-of select="/BugCollection/FindBugsSummary/@num_packages" /> packages), + (<xsl:value-of select="/BugCollection/FindBugsSummary/@total_classes" /> classes) + </td> + <td class='summary-size'><xsl:value-of select="/BugCollection/FindBugsSummary/@total_size" /></td> + <td class='summary-priority-all'><xsl:value-of select="/BugCollection/FindBugsSummary/@total_bugs" /></td> + <td class='summary-priority-1'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_1" /></td> + <td class='summary-priority-2'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_2" /></td> + <td class='summary-priority-3'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_3" /></td> + <td class='summary-priority-4'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_4" /></td> + </tr> + <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats"> + <xsl:sort select="@package" order="ascending" /> + <xsl:if test="@total_bugs!='0'" > + <tr> + <td class='summary-name'><xsl:value-of select="@package" /></td> + <td class='summary-size'><xsl:value-of select="@total_size" /></td> + <td class='summary-priority-all'><xsl:value-of select="@total_bugs" /></td> + <td class='summary-priority-1'><xsl:value-of select="@priority_1" /></td> + <td class='summary-priority-2'><xsl:value-of select="@priority_2" /></td> + <td class='summary-priority-3'><xsl:value-of select="@priority_3" /></td> + <td class='summary-priority-4'><xsl:value-of select="@priority_4" /></td> + </tr> + </xsl:if> + </xsl:for-each> + </table> + </div> + + <div id='infoContainer' class='displayContainer'> + <div id='analyzed-files'> + <h3>Analyzed Files:</h3> + <ul> + <xsl:for-each select="/BugCollection/Project/Jar"> + <li><xsl:apply-templates /></li> + </xsl:for-each> + </ul> + </div> + <div id='used-libraries'> + <h3>Used Libraries:</h3> + <ul> + <xsl:for-each select="/BugCollection/Project/AuxClasspathEntry"> + <li><xsl:apply-templates /></li> + </xsl:for-each> + <xsl:if test="count(/BugCollection/Project/AuxClasspathEntry)=0" > + <li>None</li> + </xsl:if> + </ul> + </div> + <div id='analysis-error'> + <h3>Analysis Errors:</h3> + <ul> + <xsl:variable name="error-count" + select="count(/BugCollection/Errors/MissingClass)" /> + <xsl:if test="$error-count=0" > + <li>None</li> + </xsl:if> + <xsl:if test="$error-count>0" > + <li>Missing ref classes for analysis: + <ul> + <xsl:for-each select="/BugCollection/Errors/MissingClass"> + <li><xsl:apply-templates /></li> + </xsl:for-each> + </ul> + </li> + </xsl:if> + </ul> + </div> + </div> + <div id='historyContainer' class='displayContainer'>Loading...</div> + <div id='listByCategoriesContainer' class='displayContainer'>Loading...</div> + <div id='listByPackagesContainer' class='displayContainer'>Loading...</div> + </div> + + <div id='bug-collection' style='display:none;'> + <!-- advanced tooltips --> + <xsl:for-each select="/BugCollection/BugPattern"> + <xsl:variable name="b-t"><xsl:value-of select="@type" /></xsl:variable> + <div> + <xsl:attribute name="id">tip-<xsl:value-of select="$b-t" /></xsl:attribute> + <xsl:attribute name="class">tip</xsl:attribute> + <xsl:value-of select="/BugCollection/BugPattern[@type=$b-t]/Details" disable-output-escaping="yes" /> + </div> + </xsl:for-each> + + <!-- bug descriptions - hidden --> + <xsl:for-each select="/BugCollection/BugInstance[not(@last)]"> + <div style="display:none;" class='bug'> + <xsl:attribute name="id">b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" /></xsl:attribute> + <xsl:for-each select="*/Message"> + <div class="b-r"><xsl:apply-templates /></div> + </xsl:for-each> + <div class="b-d"> + <xsl:value-of select="LongMessage" disable-output-escaping="no" /> + </div> + </div> + </xsl:for-each> + </div> + </body> +</html> +</xsl:template> + + +</xsl:transform> + diff --git a/lib/findbugs/xsl/fancy.xsl b/lib/findbugs/xsl/fancy.xsl index 59092a1..5d152dd 100644 --- a/lib/findbugs/xsl/fancy.xsl +++ b/lib/findbugs/xsl/fancy.xsl @@ -1,743 +1,846 @@ -<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (C) 2005, Etienne Giraudy, InStranet Inc
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--->
-
-<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
- <xsl:output
- method="xml" indent="yes"
- doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
- doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
- encoding="UTF-8"/>
-
- <!--xsl:key name="lbc-category-key" match="/BugCollection/BugInstance" use="@category" /-->
- <xsl:key name="lbc-code-key" match="/BugCollection/BugInstance" use="concat(@category,@abbrev)" />
- <xsl:key name="lbc-bug-key" match="/BugCollection/BugInstance" use="concat(@category,@abbrev,@type)" />
-
- <xsl:key name="lbp-class-bug-type" match="/BugCollection/BugInstance" use="concat(Class/@classname,@type)" />
-
-
-<xsl:template match="/" >
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>FindBugs (<xsl:value-of select="/BugCollection/@version" />) Analysis for <xsl:value-of select="/BugCollection/Project/@filename" /></title>
- <script type="text/javascript">
- function show(foo) {
- document.getElementById(foo).style.display="block";
- }
- function hide(foo) {
- document.getElementById(foo).style.display="none";
- }
- function toggle(foo) {
- if( document.getElementById(foo).style.display == "none") {
- show(foo);
- } else {
- if( document.getElementById(foo).style.display == "block") {
- hide(foo);
- } else {
- show(foo);
- }
- }
- }
- function showmenu(foo) {
- if( document.getElementById(foo).style.display == "none") {
- hide("bug-summary");
- document.getElementById("bug-summary-tab").className="menu-tab";
- hide("analysis-data");
- document.getElementById("analysis-data-tab").className="menu-tab";
- //hide("list-by-bug-type");
- //document.getElementById("list-by-bug-type-tab").className="menu-tab";
- hide("list-by-package");
- document.getElementById("list-by-package-tab").className="menu-tab";
- hide("list-by-category");
- document.getElementById("list-by-category-tab").className="menu-tab";
- document.getElementById(foo+"-tab").className="menu-tab-selected";
- show(foo);
- }
- // else menu already selected!
- }
- </script>
- <style type='text/css'>
- html, body {
- background-color: #ffffff;
- }
- a, a:link , a:active, a:visited, a:hover {
- text-decoration: none; color: black;
- }
- div, span {
- vertical-align: top;
- }
- p {
- margin: 0px;
- }
- #header {
- width: 100%;
- text-align: center;
- margin-bottom: 5px;
- font-size: 14pt;
- color: red;
- }
- #menu {
- margin-bottom: 10px;
- }
- #menu ul {
- margin-left: 0;
- padding-left: 0;
- display: inline;
- }
- #menu ul li {
- margin-left: 0;
- margin-bottom: 0;
- padding: 2px 15px 5px;
- border: 1px solid #000;
- list-style: none;
- display: inline;
- }
- #menu ul li.here {
- border-bottom: 1px solid #ffc;
- list-style: none;
- display: inline;
- }
- .menu-tab {
- background: white;
- }
- .menu-tab:hover {
- background: grey;
- }
- .menu-tab-selected {
- background: #aaaaaa;
- }
- #analysis-data ul {
- margin-left: 15px;
- }
- #analyzed-files, #used-libraries, #analysis-error {
- float: left;
- margin: 2px;
- border: 1px black solid;
- padding: 2px;
- overflow:auto;
- }
- #analyzed-files {
- width: 25%;
- }
- #used-libraries {
- width: 25%;
- }
- #analysis-error {
- width: 40%;
- }
- div.summary {
- width:100%;
- text-align:center;
- }
- .summary table {
- border:1px solid black;
- }
- .summary th {
- background: #aaaaaa;
- color: white;
- }
- .summary th, .summary td {
- padding: 2px 4px 2px 4px;
- }
- .summary-name {
- background: #eeeeee;
- text-align:left;
- }
- .summary-size {
- background: #eeeeee;
- text-align:center;
- }
- .summary-ratio {
- background: #eeeeee;
- text-align:center;
- }
- .summary-priority-all {
- background: #dddddd;
- text-align:center;
- }
- .summary-priority-1 {
- background: red;
- text-align:center;
- }
- .summary-priority-2 {
- background: orange;
- text-align:center;
- }
- .summary-priority-3 {
- background: green;
- text-align:center;
- }
- .summary-priority-4 {
- background: blue;
- text-align:center;
- }
- .outerbox {
- border: 1px solid black;
- margin: 10px;
- }
- .outerbox-title {
- border-bottom: 1px solid #000000; font-size: 12pt; font-weight: bold;
- background: #cccccc; margin: 0; padding: 0 5px 0 5px;
- }
- .title-help {
- font-weight: normal;
- }
- .innerbox-1, .innerbox-2 {
- margin: 0 0 0 10px;
- }
- .innerbox-1-title, .innerbox-2-title {
- border-bottom: 1px solid #000000; border-left: 1px solid #000000;
- margin: 0; padding: 0 5px 0 5px;
- font-size: 12pt; font-weight: bold; background: #cccccc;
- }
- .bug-box {
- border-bottom: 1px solid #000000; border-left: 1px solid #000000;
- }
- .bug-priority-1 {
- background: red; height: 0.5em; width: 1em;
- margin-right: 0.5em;
- }
- .bug-priority-2 {
- background: orange; height: 0.5em; width: 1em;
- margin-right: 0.5em;
- }
- .bug-priority-3 {
- background: green; height: 0.5em; width: 1em;
- margin-right: 0.5em;
- }
- .bug-priority-4 {
- background: blue; height: 0.5em; width: 1em;
- margin-right: 0.5em;
- }
- .bug-type {
- }
- .bug-ref {
- font-size: 10pt; font-weight: bold; padding: 0 0 0 60px;
- }
- .bug-descr {
- font-weight: normal; background: #eeeee0;
- padding: 0 5px 0 5px; border-bottom: 1px dashed black; margin: 0px;
- }
- .bug-details {
- font-weight: normal; background: #eeeee0;
- padding: 0 5px 0 5px; margin: 0px;
- }
- </style>
- </head>
- <body>
- <div id="header">
- FindBugs (<xsl:value-of select="/BugCollection/@version" />) Analysis for <xsl:value-of select="/BugCollection/Project/@filename" />
- </div>
- <div id="menu">
- <ul>
- <li id='bug-summary-tab' class='menu-tab-selected'>
- <xsl:attribute name="onclick">showmenu('bug-summary');return false;</xsl:attribute>
- <a href='' onclick='return false;'>Bug Summary</a>
- </li>
- <li id='analysis-data-tab' class='menu-tab'>
- <xsl:attribute name="onclick">showmenu('analysis-data');return false;</xsl:attribute>
- <a href='' onclick='return false;'>Analysis Information</a>
- </li>
- <li id='list-by-category-tab' class='menu-tab'>
- <xsl:attribute name="onclick">showmenu('list-by-category');return false;</xsl:attribute>
- <a href='' onclick='return false;'>List bugs by bug category</a>
- </li>
- <li id='list-by-package-tab' class='menu-tab'>
- <xsl:attribute name="onclick">showmenu('list-by-package');return false;</xsl:attribute>
- <a href='' onclick='return false;'>List bugs by package</a>
- </li>
- </ul>
- </div>
- <xsl:call-template name="generateSummary" />
- <xsl:call-template name="analysis-data" />
- <xsl:call-template name="list-by-category" />
- <xsl:call-template name="list-by-package" />
- </body>
-</html>
-</xsl:template>
-
-<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-<!-- generate summary report from stats -->
-<xsl:template name="generateSummary" >
-<div class='summary' id='bug-summary'>
- <h2>FindBugs Analysis generated at: <xsl:value-of select="/BugCollection/FindBugsSummary/@timestamp" /></h2>
- <table>
- <tr>
- <th>Package</th>
- <th>Code Size</th>
- <th>Bugs</th>
- <th>Bugs p1</th>
- <th>Bugs p2</th>
- <th>Bugs p3</th>
- <th>Bugs Exp.</th>
- <th>Ratio</th>
- </tr>
- <tr>
- <td class='summary-name'>
- Overall
- (<xsl:value-of select="/BugCollection/FindBugsSummary/@num_packages" /> packages),
- (<xsl:value-of select="/BugCollection/FindBugsSummary/@total_classes" /> classes)
- </td>
- <td class='summary-size'><xsl:value-of select="/BugCollection/FindBugsSummary/@total_size" /></td>
- <td class='summary-priority-all'><xsl:value-of select="/BugCollection/FindBugsSummary/@total_bugs" /></td>
- <td class='summary-priority-1'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_1" /></td>
- <td class='summary-priority-2'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_2" /></td>
- <td class='summary-priority-3'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_3" /></td>
- <td class='summary-priority-4'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_4" /></td>
- <td class='summary-ratio'></td>
- </tr>
- <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats">
- <xsl:sort select="@package" />
- <xsl:if test="@total_bugs!='0'" >
- <tr>
- <td class='summary-name'><xsl:value-of select="@package" /></td>
- <td class='summary-size'><xsl:value-of select="@total_size" /></td>
- <td class='summary-priority-all'><xsl:value-of select="@total_bugs" /></td>
- <td class='summary-priority-1'><xsl:value-of select="@priority_1" /></td>
- <td class='summary-priority-2'><xsl:value-of select="@priority_2" /></td>
- <td class='summary-priority-3'><xsl:value-of select="@priority_3" /></td>
- <td class='summary-priority-4'><xsl:value-of select="@priority_4" /></td>
- <td class='summary-ratio'></td>
-<!--
- <xsl:for-each select="ClassStats">
- <xsl:if test="@bugs!='0'" >
- <li>
- <xsl:value-of select="@class" /> - total: <xsl:value-of select="@bugs" />
- </li>
- </xsl:if>
- </xsl:for-each>
--->
- </tr>
- </xsl:if>
- </xsl:for-each>
- </table>
-</div>
-</xsl:template>
-
-<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-<!-- display analysis info -->
-<xsl:template name="analysis-data">
- <div id='analysis-data' style='display:none;'>
- <div id='analyzed-files'>
- Analyzed Files:
- <ul>
- <xsl:for-each select="/BugCollection/Project/Jar">
- <li><xsl:apply-templates /></li>
- </xsl:for-each>
- </ul>
- </div>
- <div id='used-libraries'>
- Used Libraries:
- <ul>
- <xsl:for-each select="/BugCollection/Project/AuxClasspathEntry">
- <li><xsl:apply-templates /></li>
- </xsl:for-each>
- <xsl:if test="count(/BugCollection/Project/AuxClasspathEntry)=0" >
- <li>None</li>
- </xsl:if>
- </ul>
- </div>
- <div id='analysis-error'>
- Analysis Errors:
- <ul>
- <xsl:variable name="error-count"
- select="count(/BugCollection/Errors/MissingClass)" />
- <xsl:if test="$error-count=0" >
- <li>None</li>
- </xsl:if>
- <xsl:if test="$error-count>0" >
- <li>Missing ref classes for analysis:
- <ul>
- <xsl:for-each select="/BugCollection/Errors/MissingClass">
- <li><xsl:apply-templates /></li>
- </xsl:for-each>
- </ul>
- </li>
- </xsl:if>
- </ul>
- </div>
- </div>
-</xsl:template>
-
-<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-<!-- show priorities helper -->
-<xsl:template name="helpPriorities">
- <span>
- <xsl:attribute name="class">bug-priority-1</xsl:attribute>
-   
- </span> P1
- <span>
- <xsl:attribute name="class">bug-priority-2</xsl:attribute>
-   
- </span> P2
- <span>
- <xsl:attribute name="class">bug-priority-3</xsl:attribute>
-   
- </span> P3
- <span>
- <xsl:attribute name="class">bug-priority-4</xsl:attribute>
-   
- </span> Exp.
-</xsl:template>
-
-<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-<!-- display the details of a bug -->
-<xsl:template name="display-bug" >
- <xsl:param name="bug-type" select="''" />
- <xsl:param name="bug-id" select="''" />
- <xsl:param name="which-list" select="''" />
- <div class="bug-box">
- <a>
- <xsl:attribute name="href"></xsl:attribute>
- <xsl:attribute name="onclick">toggle('<xsl:value-of select="$which-list" />-<xsl:value-of select="@uid" />');return false;</xsl:attribute>
- <span>
- <xsl:attribute name="class">bug-priority-<xsl:value-of select="@priority"/></xsl:attribute>
-   
- </span>
- <span class="bug-type"><xsl:value-of select="@abbrev" />: </span> <xsl:value-of select="Class/Message" />
- </a>
- <div style="display:none;">
- <xsl:attribute name="id"><xsl:value-of select="$which-list" />-<xsl:value-of select="@uid" /></xsl:attribute>
- <xsl:for-each select="*/Message">
- <div class="bug-ref"><xsl:apply-templates /></div>
- </xsl:for-each>
- <div class="bug-descr">
- <xsl:value-of select="LongMessage" disable-output-escaping="no" />
- </div>
- <div class="bug-details"><xsl:value-of select="/BugCollection/BugPattern[@type=$bug-type]/Details" disable-output-escaping="yes" /></div>
- </div>
- </div>
-</xsl:template>
-
-<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-<!-- main template for the list by category -->
-<xsl:template name="list-by-category" >
- <div id='list-by-category' class='data-box' style='display:none;'>
- <xsl:call-template name="helpPriorities" />
- <xsl:variable name="unique-category" select="/BugCollection/BugCategory/@category"/>
- <!--xsl:variable name="unique-category" select="/BugCollection/BugInstance[generate-id() = generate-id(key('lbc-category-key',@category))]/@category" /-->
- <xsl:for-each select="$unique-category">
- <xsl:sort select="." order="ascending" />
- <xsl:call-template name="categories">
- <xsl:with-param name="category" select="." />
- </xsl:call-template>
- </xsl:for-each>
- </div>
-</xsl:template>
-
-<xsl:template name="categories" >
- <xsl:param name="category" select="''" />
- <xsl:variable name="category-count"
- select="count(/BugCollection/BugInstance[@category=$category])" />
- <xsl:variable name="category-count-p1"
- select="count(/BugCollection/BugInstance[@category=$category and @priority='1'])" />
- <xsl:variable name="category-count-p2"
- select="count(/BugCollection/BugInstance[@category=$category and @priority='2'])" />
- <xsl:variable name="category-count-p3"
- select="count(/BugCollection/BugInstance[@category=$category and @priority='3'])" />
- <xsl:variable name="category-count-p4"
- select="count(/BugCollection/BugInstance[@category=$category and @priority='4'])" />
- <div class='outerbox'>
- <div class='outerbox-title'>
- <a>
- <xsl:attribute name="href"></xsl:attribute>
- <xsl:attribute name="onclick">toggle('category-<xsl:value-of select="$category" />');return false;</xsl:attribute>
- <xsl:value-of select="/BugCollection/BugCategory[@category=$category]/Description" />
- (<xsl:value-of select="$category-count" />:
- <span class='title-help'><xsl:value-of select="$category-count-p1" />/<xsl:value-of select="$category-count-p2" />/<xsl:value-of select="$category-count-p3" />/<xsl:value-of select="$category-count-p4" /></span>)
- </a>
- </div>
- <div style="display:none;">
- <xsl:attribute name="id">category-<xsl:value-of select="$category" /></xsl:attribute>
- <xsl:call-template name="list-by-category-and-code">
- <xsl:with-param name="category" select="$category" />
- </xsl:call-template>
- </div>
- </div>
-</xsl:template>
-
-<xsl:template name="list-by-category-and-code" >
- <xsl:param name="category" select="''" />
- <xsl:variable name="unique-code" select="/BugCollection/BugInstance[@category=$category and generate-id()= generate-id(key('lbc-code-key',concat(@category,@abbrev)))]/@abbrev" />
- <xsl:for-each select="$unique-code">
- <xsl:sort select="." order="ascending" />
- <xsl:call-template name="codes">
- <xsl:with-param name="category" select="$category" />
- <xsl:with-param name="code" select="." />
- </xsl:call-template>
- </xsl:for-each>
-</xsl:template>
-
-<xsl:template name="codes" >
- <xsl:param name="category" select="''" />
- <xsl:param name="code" select="''" />
- <xsl:variable name="code-count"
- select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code])" />
- <xsl:variable name="code-count-p1"
- select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='1'])" />
- <xsl:variable name="code-count-p2"
- select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='2'])" />
- <xsl:variable name="code-count-p3"
- select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='3'])" />
- <xsl:variable name="code-count-p4"
- select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='4'])" />
- <div class='innerbox-1'>
- <div class="innerbox-1-title">
- <a>
- <xsl:attribute name="href"></xsl:attribute>
- <xsl:attribute name="onclick">toggle('category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />');return false;</xsl:attribute>
- <xsl:value-of select="$code" />: <xsl:value-of select="/BugCollection/BugCode[@abbrev=$code]/Description" />
- (<xsl:value-of select="$code-count" />:
- <span class='title-help'><xsl:value-of select="$code-count-p1" />/<xsl:value-of select="$code-count-p2" />/<xsl:value-of select="$code-count-p3" />/<xsl:value-of select="$code-count-p4" /></span>)
- </a>
- </div>
- <div style="display:none;">
- <xsl:attribute name="id">category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" /></xsl:attribute>
- <xsl:call-template name="list-by-category-and-code-and-bug">
- <xsl:with-param name="category" select="$category" />
- <xsl:with-param name="code" select="$code" />
- </xsl:call-template>
- </div>
- </div>
-</xsl:template>
-
-<xsl:template name="list-by-category-and-code-and-bug" >
- <xsl:param name="category" select="''" />
- <xsl:param name="code" select="''" />
- <xsl:variable name="unique-bug" select="/BugCollection/BugInstance[@category=$category and @abbrev=$code and generate-id()= generate-id(key('lbc-bug-key',concat(@category,@abbrev,@type)))]/@type" />
- <xsl:for-each select="$unique-bug">
- <xsl:sort select="." order="ascending" />
- <xsl:call-template name="bugs">
- <xsl:with-param name="category" select="$category" />
- <xsl:with-param name="code" select="$code" />
- <xsl:with-param name="bug" select="." />
- </xsl:call-template>
- </xsl:for-each>
-</xsl:template>
-
-<xsl:template name="bugs" >
- <xsl:param name="category" select="''" />
- <xsl:param name="code" select="''" />
- <xsl:param name="bug" select="''" />
- <xsl:variable name="bug-count"
- select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug])" />
- <xsl:variable name="bug-count-p1"
- select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='1'])" />
- <xsl:variable name="bug-count-p2"
- select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='2'])" />
- <xsl:variable name="bug-count-p3"
- select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='3'])" />
- <xsl:variable name="bug-count-p4"
- select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='4'])" />
- <div class='innerbox-2'>
- <div class='innerbox-2-title'>
- <a>
- <xsl:attribute name="href"></xsl:attribute>
- <xsl:attribute name="onclick">toggle('category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />-and-bug-<xsl:value-of select="$bug" />');return false;</xsl:attribute>
- <xsl:attribute name="title"><xsl:value-of select="$bug" /></xsl:attribute>
- <xsl:value-of select="/BugCollection/BugPattern[@category=$category and @abbrev=$code and @type=$bug]/ShortDescription" />  
- (<xsl:value-of select="$bug-count" />:
- <span class='title-help'><xsl:value-of select="$bug-count-p1" />/<xsl:value-of select="$bug-count-p2" />/<xsl:value-of select="$bug-count-p3" />/<xsl:value-of select="$bug-count-p4" /></span>)
- </a>
- </div>
- <div style="display:none;">
- <xsl:attribute name="id">category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />-and-bug-<xsl:value-of select="$bug" /></xsl:attribute>
- <xsl:variable name="cat-code-type">category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />-and-bug-<xsl:value-of select="$bug" /></xsl:variable>
- <xsl:for-each select="/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug]">
- <xsl:call-template name="display-bug">
- <xsl:with-param name="bug-type" select="@type" />
- <xsl:with-param name="bug-id" select="@uid" />
- <xsl:with-param name="which-list" select="$cat-code-type" />
- </xsl:call-template>
- </xsl:for-each>
- </div>
- </div>
-</xsl:template>
-
-<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-<!-- main template for the list by package -->
-<xsl:template name="list-by-package" >
- <div id='list-by-package' class='data-box' style='display:none;'>
- <xsl:call-template name="helpPriorities" />
- <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats[@total_bugs != '0']/@package">
- <xsl:sort select="." order="ascending" />
- <xsl:call-template name="packages">
- <xsl:with-param name="package" select="." />
- </xsl:call-template>
- </xsl:for-each>
- </div>
-</xsl:template>
-
-<xsl:template name="packages" >
- <xsl:param name="package" select="''" />
- <xsl:variable name="package-count-p1">
- <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_1 != '')">0</xsl:if>
- <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_1 != ''">
- <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_1" />
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="package-count-p2">
- <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_2 != '')">0</xsl:if>
- <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_2 != ''">
- <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_2" />
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="package-count-p3">
- <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_3 != '')">0</xsl:if>
- <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_3 != ''">
- <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_3" />
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="package-count-p4">
- <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_4 != '')">0</xsl:if>
- <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_4 != ''">
- <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_4" />
- </xsl:if>
- </xsl:variable>
-
- <div class='outerbox'>
- <div class='outerbox-title'>
- <a>
- <xsl:attribute name="href"></xsl:attribute>
- <xsl:attribute name="onclick">toggle('package-<xsl:value-of select="$package" />');return false;</xsl:attribute>
- <xsl:value-of select="$package" />
- (<xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@total_bugs" />:
- <span class='title-help'><xsl:value-of select="$package-count-p1" />/<xsl:value-of select="$package-count-p2" />/<xsl:value-of select="$package-count-p3" />/<xsl:value-of select="$package-count-p4" /></span>)
- </a>
- </div>
- <div style="display:none;">
- <xsl:attribute name="id">package-<xsl:value-of select="$package" /></xsl:attribute>
- <xsl:call-template name="list-by-package-and-class">
- <xsl:with-param name="package" select="$package" />
- </xsl:call-template>
- </div>
- </div>
-</xsl:template>
-
-<xsl:template name="list-by-package-and-class" >
- <xsl:param name="package" select="''" />
- <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@bugs != '0']/@class">
- <xsl:sort select="." order="ascending" />
- <xsl:call-template name="classes">
- <xsl:with-param name="package" select="$package" />
- <xsl:with-param name="class" select="." />
- </xsl:call-template>
- </xsl:for-each>
-</xsl:template>
-
-<xsl:template name="classes" >
- <xsl:param name="package" select="''" />
- <xsl:param name="class" select="''" />
- <xsl:variable name="class-count"
- select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@bugs" />
-
- <xsl:variable name="class-count-p1">
- <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_1 != '')">0</xsl:if>
- <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_1 != ''">
- <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_1" />
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="class-count-p2">
- <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_2 != '')">0</xsl:if>
- <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_2 != ''">
- <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_2" />
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="class-count-p3">
- <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_3 != '')">0</xsl:if>
- <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_3 != ''">
- <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_3" />
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="class-count-p4">
- <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_4 != '')">0</xsl:if>
- <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_4 != ''">
- <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_4" />
- </xsl:if>
- </xsl:variable>
-
-
- <div class='innerbox-1'>
- <div class="innerbox-1-title">
- <a>
- <xsl:attribute name="href"></xsl:attribute>
- <xsl:attribute name="onclick">toggle('package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />');return false;</xsl:attribute>
- <xsl:value-of select="$class" /> (<xsl:value-of select="$class-count" />:
- <span class='title-help'><xsl:value-of select="$class-count-p1" />/<xsl:value-of select="$class-count-p2" />/<xsl:value-of select="$class-count-p3" />/<xsl:value-of select="$class-count-p4" /></span>)
- </a>
- </div>
- <div style="display:none;">
- <xsl:attribute name="id">package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" /></xsl:attribute>
- <xsl:call-template name="list-by-package-and-class-and-bug">
- <xsl:with-param name="package" select="$package" />
- <xsl:with-param name="class" select="$class" />
- </xsl:call-template>
- </div>
- </div>
-</xsl:template>
-
-
-<xsl:template name="list-by-package-and-class-and-bug" >
- <xsl:param name="package" select="''" />
- <xsl:param name="class" select="''" />
- <xsl:variable name="unique-class-bugs" select="/BugCollection/BugInstance[Class[position()=1 and @classname=$class] and generate-id() = generate-id(key('lbp-class-bug-type',concat(Class/@classname,@type)))]/@type" />
-
- <xsl:for-each select="$unique-class-bugs">
- <xsl:sort select="." order="ascending" />
- <xsl:call-template name="class-bugs">
- <xsl:with-param name="package" select="$package" />
- <xsl:with-param name="class" select="$class" />
- <xsl:with-param name="type" select="." />
- </xsl:call-template>
- </xsl:for-each>
-</xsl:template>
-
-<xsl:template name="class-bugs" >
- <xsl:param name="package" select="''" />
- <xsl:param name="class" select="''" />
- <xsl:param name="type" select="''" />
- <xsl:variable name="bug-count"
- select="count(/BugCollection/BugInstance[@type=$type and Class[position()=1 and @classname=$class]])" />
- <div class='innerbox-2'>
- <div class='innerbox-2-title'>
- <a>
- <xsl:attribute name="href"></xsl:attribute>
- <xsl:attribute name="onclick">toggle('package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />-and-type-<xsl:value-of select="$type" />');return false;</xsl:attribute>
- <xsl:attribute name="title"><xsl:value-of select="$type" /></xsl:attribute>
- <xsl:value-of select="/BugCollection/BugPattern[@type=$type]/ShortDescription" />  
- (<xsl:value-of select="$bug-count" />)
- </a>
- </div>
- <div style="display:none;">
- <xsl:attribute name="id">package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />-and-type-<xsl:value-of select="$type" /></xsl:attribute>
- <xsl:variable name="package-class-type">package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />-and-type-<xsl:value-of select="$type" /></xsl:variable>
- <xsl:for-each select="/BugCollection/BugInstance[@type=$type and Class[position()=1 and @classname=$class]]">
- <xsl:call-template name="display-bug">
- <xsl:with-param name="bug-type" select="@type" />
- <xsl:with-param name="bug-id" select="@uid" />
- <xsl:with-param name="which-list" select="$package-class-type" />
- </xsl:call-template>
- </xsl:for-each>
- </div>
- </div>
-</xsl:template>
-
-
-
-</xsl:transform>
\ No newline at end of file +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Copyright (C) 2005, 2006 Etienne Giraudy, InStranet Inc + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +--> + +<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > + <xsl:output + method="xml" indent="yes" + doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" + doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" + encoding="UTF-8"/> + + <!-- + Parameter for specifying HTMLized sources location; if current dir, use "./" + If not passed, no links to sources are generated. + because of back-compatibility reasons. + The source filename should be package.class.java.html + The source can have line no anchors like #11 --> + <xsl:param name="htmlsrcpath"></xsl:param> + + <!--xsl:key name="lbc-category-key" match="/BugCollection/BugInstance" use="@category" /--> + <xsl:key name="lbc-code-key" match="/BugCollection/BugInstance" use="concat(@category,@abbrev)" /> + <xsl:key name="lbc-bug-key" match="/BugCollection/BugInstance" use="concat(@category,@abbrev,@type)" /> + <xsl:key name="lbp-class-b-t" match="/BugCollection/BugInstance" use="concat(Class/@classname,@type)" /> + +<xsl:template match="/" > + +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <title> + FindBugs (<xsl:value-of select="/BugCollection/@version" />) + Analysis for + <xsl:choose> + <xsl:when test='string-length(/BugCollection/Project/@projectName)>0'><xsl:value-of select="/BugCollection/Project/@projectName" /></xsl:when> + <xsl:otherwise><xsl:value-of select="/BugCollection/Project/@filename" /></xsl:otherwise> + </xsl:choose> + </title> + <script type="text/javascript"> + function show(foo) { + document.getElementById(foo).style.display="block"; + } + function hide(foo) { + document.getElementById(foo).style.display="none"; + } + function toggle(foo) { + if( document.getElementById(foo).style.display == "none") { + show(foo); + } else { + if( document.getElementById(foo).style.display == "block") { + hide(foo); + } else { + show(foo); + } + } + } + + function showmenu(foo) { + if( document.getElementById(foo).style.display == "none") { + hide("bug-summary"); + document.getElementById("bug-summary-tab").className="menu-tab"; + hide("analysis-data"); + document.getElementById("analysis-data-tab").className="menu-tab"; + //hide("list-by-b-t"); + //document.getElementById("list-by-b-t-tab").className="menu-tab"; + hide("list-by-package"); + document.getElementById("list-by-package-tab").className="menu-tab"; + hide("list-by-category"); + document.getElementById("list-by-category-tab").className="menu-tab"; + document.getElementById(foo+"-tab").className="menu-tab-selected"; + show(foo); + + } + // else menu already selected! + } + function showbug(buguid, list) { + var bugplaceholder = document.getElementById(buguid+'-ph-'+list); + var bug = document.getElementById(buguid); + + if ( bugplaceholder==null) { + alert(buguid+'-ph-'+list+' - '+buguid+' - bugplaceholder==null'); + return; + } + if ( bug==null) { + alert(buguid+'-ph-'+list+' - '+buguid+' - bug==null'); + return; + } + + var oldBug = bugplaceholder.innerHTML; + var newBug = bug.innerHTML; + //alert(oldBug); + //alert(newBug); + toggle(buguid+'-ph-'+list); + bugplaceholder.innerHTML = newBug; + } + </script> + <script type='text/javascript'><xsl:text disable-output-escaping='yes'><![CDATA[ + // Extended Tooltip Javascript + // copyright 9th August 2002, 3rd July 2005 + // by Stephen Chapman, Felgall Pty Ltd + + // permission is granted to use this javascript provided that the below code is not altered + var DH = 0;var an = 0;var al = 0;var ai = 0;if (document.getElementById) {ai = 1; DH = 1;}else {if (document.all) {al = 1; DH = 1;} else { browserVersion = parseInt(navigator.appVersion); if (navigator.appName.indexOf('Netscape') != -1) if (browserVersion == 4) {an = 1; DH = 1;}}} + function fd(oi, wS) {if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); if (al) return wS ? document.all[oi].style: document.all[oi]; if (an) return document.layers[oi];} + function pw() {return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;} + function mouseX(evt) {if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); else return null;} + function mouseY(evt) {if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null;} + function popUp(evt,oi) {if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/4); if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; ds.visibility = "visible";}}} + ]]></xsl:text></script> + <style type='text/css'> + html, body { + background-color: #ffffff; + } + a, a:link , a:active, a:visited, a:hover { + text-decoration: none; color: black; + } + .b-r a { + text-decoration: underline; color: blue; + } + div, span { + vertical-align: top; + } + p { + margin: 0px; + } + h1 { + /*font-size: 14pt;*/ + color: red; + } + #menu { + margin-bottom: 10px; + } + #menu ul { + margin-left: 0; + padding-left: 0; + display: inline; + } + #menu ul li { + margin-left: 0; + margin-bottom: 0; + padding: 2px 15px 5px; + border: 1px solid #000; + list-style: none; + display: inline; + } + #menu ul li.here { + border-bottom: 1px solid #ffc; + list-style: none; + display: inline; + } + .menu-tab { + background: white; + } + .menu-tab:hover { + background: grey; + } + .menu-tab-selected { + background: #aaaaaa; + } + #analysis-data ul { + margin-left: 15px; + } + #analyzed-files, #used-libraries, #analysis-error { + margin: 2px; + border: 1px black solid; + padding: 2px; + float: left; + overflow:auto; + } + #analyzed-files { + width: 25%; + } + #used-libraries { + width: 25%; + } + #analysis-error { + width: 40%; + } + div.summary { + width:100%; + text-align:left; + } + .summary table { + border:1px solid black; + } + .summary th { + background: #aaaaaa; + color: white; + } + .summary th, .summary td { + padding: 2px 4px 2px 4px; + } + .summary-name { + background: #eeeeee; + text-align:left; + } + .summary-size { + background: #eeeeee; + text-align:center; + } + .summary-ratio { + background: #eeeeee; + text-align:center; + } + .summary-priority-all { + background: #dddddd; + text-align:center; + } + .summary-priority-1 { + background: red; + text-align:center; + } + .summary-priority-2 { + background: orange; + text-align:center; + } + .summary-priority-3 { + background: green; + text-align:center; + } + .summary-priority-4 { + background: blue; + text-align:center; + } + .ob { + border: 1px solid black; + margin: 10px; + } + .ob-t { + border-bottom: 1px solid #000000; font-size: 12pt; font-weight: bold; + background: #cccccc; margin: 0; padding: 0 5px 0 5px; + } + .t-h { + font-weight: normal; + } + .ib-1, .ib-2 { + margin: 0 0 0 10px; + } + .ib-1-t, .ib-2-t { + border-bottom: 1px solid #000000; border-left: 1px solid #000000; + margin: 0; padding: 0 5px 0 5px; + font-size: 12pt; font-weight: bold; background: #cccccc; + } + .bb { + border-bottom: 1px solid #000000; border-left: 1px solid #000000; + } + .b-1 { + background: red; height: 0.5em; width: 1em; + margin-right: 0.5em; + } + .b-2 { + background: orange; height: 0.5em; width: 1em; + margin-right: 0.5em; + } + .b-3 { + background: green; height: 0.5em; width: 1em; + margin-right: 0.5em; + } + .b-4 { + background: blue; height: 0.5em; width: 1em; + margin-right: 0.5em; + } + .b-t { + } + .b-r { + font-size: 10pt; font-weight: bold; padding: 0 0 0 60px; + } + .b-d { + font-weight: normal; background: #eeeee0; + padding: 0 5px 0 5px; margin: 0px; + } + .bug-placeholder { + top:140px; + border:1px solid black; + display:none; + } + .tip { + border:solid 1px #666666; + width:600px; + padding:3px; + position:absolute; + z-index:100; + visibility:hidden; + color:#333333; + top:20px; + left:90px; + background-color:#ffffcc; + layer-background-color:#ffffcc; + } + + + </style> + </head> + <body> + <div id='content'> + <h1> + FindBugs (<xsl:value-of select="/BugCollection/@version" />) + Analysis for + <xsl:choose> + <xsl:when test='string-length(/BugCollection/Project/@projectName)>0'><xsl:value-of select="/BugCollection/Project/@projectName" /></xsl:when> + <xsl:otherwise><xsl:value-of select="/BugCollection/Project/@filename" /></xsl:otherwise> + </xsl:choose> + </h1> + <div id="menu"> + <ul> + <li id='bug-summary-tab' class='menu-tab-selected'> + <xsl:attribute name="onclick">showmenu('bug-summary');return false;</xsl:attribute> + <a href='' onclick='return false;'>Bug Summary</a> + </li> + <li id='analysis-data-tab' class='menu-tab'> + <xsl:attribute name="onclick">showmenu('analysis-data');return false;</xsl:attribute> + <a href='' onclick='return false;'>Analysis Information</a> + </li> + <li id='list-by-category-tab' class='menu-tab'> + <xsl:attribute name="onclick">showmenu('list-by-category');return false;</xsl:attribute> + <a href='' onclick='return false;'>List bugs by bug category</a> + </li> + <li id='list-by-package-tab' class='menu-tab'> + <xsl:attribute name="onclick">showmenu('list-by-package');return false;</xsl:attribute> + <a href='' onclick='return false;'>List bugs by package</a> + </li> + </ul> + </div> + <xsl:call-template name="generateSummary" /> + <xsl:call-template name="analysis-data" /> + <xsl:call-template name="list-by-category" /> + <xsl:call-template name="list-by-package" /> + + + <!-- advanced tooltips --> + <xsl:for-each select="/BugCollection/BugPattern"> + <xsl:variable name="b-t"><xsl:value-of select="@type" /></xsl:variable> + <div> + <xsl:attribute name="id">tip-<xsl:value-of select="$b-t" /></xsl:attribute> + <xsl:attribute name="class">tip</xsl:attribute> + <b><xsl:value-of select="@abbrev" /> / <xsl:value-of select="@type" /></b><br/> + <xsl:value-of select="/BugCollection/BugPattern[@type=$b-t]/Details" disable-output-escaping="yes" /> + </div> + </xsl:for-each> + + <!-- bug descriptions - hidden --> + <xsl:for-each select="/BugCollection/BugInstance[not(@last)]"> + <div style="display:none;"> + <xsl:attribute name="id">b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" /></xsl:attribute> + <xsl:for-each select="*/Message"> + <xsl:choose> + <xsl:when test="parent::SourceLine and $htmlsrcpath != '' "> + <div class="b-r"><a> + <xsl:attribute name="href"><xsl:value-of select="$htmlsrcpath"/><xsl:value-of select="../@sourcepath" />.html#<xsl:value-of select="../@start" /></xsl:attribute> + <xsl:apply-templates /> + </a></div> + </xsl:when> + <xsl:otherwise> + <div class="b-r"><xsl:apply-templates /></div> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + <div class="b-d"> + <xsl:value-of select="LongMessage" disable-output-escaping="no" /> + </div> + </div> + </xsl:for-each> + </div> + <div id='fixedbox'> + <div id='bug-placeholder'></div> + </div> + </body> +</html> +</xsl:template> + +<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> +<!-- generate summary report from stats --> +<xsl:template name="generateSummary" > +<div class='summary' id='bug-summary'> + <h2>FindBugs Analysis generated at: <xsl:value-of select="/BugCollection/FindBugsSummary/@timestamp" /></h2> + <table> + <tr> + <th>Package</th> + <th>Code Size</th> + <th>Bugs</th> + <th>Bugs p1</th> + <th>Bugs p2</th> + <th>Bugs p3</th> + <th>Bugs Exp.</th> + <th>Ratio</th> + </tr> + <tr> + <td class='summary-name'> + Overall + (<xsl:value-of select="/BugCollection/FindBugsSummary/@num_packages" /> packages), + (<xsl:value-of select="/BugCollection/FindBugsSummary/@total_classes" /> classes) + </td> + <td class='summary-size'><xsl:value-of select="/BugCollection/FindBugsSummary/@total_size" /></td> + <td class='summary-priority-all'><xsl:value-of select="/BugCollection/FindBugsSummary/@total_bugs" /></td> + <td class='summary-priority-1'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_1" /></td> + <td class='summary-priority-2'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_2" /></td> + <td class='summary-priority-3'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_3" /></td> + <td class='summary-priority-4'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_4" /></td> + <td class='summary-ratio'></td> + </tr> + <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats"> + <xsl:sort select="@package" /> + <xsl:if test="@total_bugs!='0'" > + <tr> + <td class='summary-name'><xsl:value-of select="@package" /></td> + <td class='summary-size'><xsl:value-of select="@total_size" /></td> + <td class='summary-priority-all'><xsl:value-of select="@total_bugs" /></td> + <td class='summary-priority-1'><xsl:value-of select="@priority_1" /></td> + <td class='summary-priority-2'><xsl:value-of select="@priority_2" /></td> + <td class='summary-priority-3'><xsl:value-of select="@priority_3" /></td> + <td class='summary-priority-4'><xsl:value-of select="@priority_4" /></td> + <td class='summary-ratio'></td> +<!-- + <xsl:for-each select="ClassStats"> + <xsl:if test="@bugs!='0'" > + <li> + <xsl:value-of select="@class" /> - total: <xsl:value-of select="@bugs" /> + </li> + </xsl:if> + </xsl:for-each> +--> + </tr> + </xsl:if> + </xsl:for-each> + </table> +</div> +</xsl:template> + +<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> +<!-- display analysis info --> +<xsl:template name="analysis-data"> + <div id='analysis-data' style='display:none;'> + <div id='analyzed-files'> + <h3>Analyzed Files:</h3> + <ul> + <xsl:for-each select="/BugCollection/Project/Jar"> + <li><xsl:apply-templates /></li> + </xsl:for-each> + </ul> + </div> + <div id='used-libraries'> + <h3>Used Libraries:</h3> + <ul> + <xsl:for-each select="/BugCollection/Project/AuxClasspathEntry"> + <li><xsl:apply-templates /></li> + </xsl:for-each> + <xsl:if test="count(/BugCollection/Project/AuxClasspathEntry)=0" > + <li>None</li> + </xsl:if> + </ul> + </div> + <div id='analysis-error'> + <h3>Analysis Errors:</h3> + <ul> + <xsl:variable name="error-count" + select="count(/BugCollection/Errors/MissingClass)" /> + <xsl:if test="$error-count=0" > + <li>None</li> + </xsl:if> + <xsl:if test="$error-count>0" > + <li>Missing ref classes for analysis: + <ul> + <xsl:for-each select="/BugCollection/Errors/MissingClass"> + <li><xsl:apply-templates /></li> + </xsl:for-each> + </ul> + </li> + </xsl:if> + </ul> + </div> + </div> +</xsl:template> + +<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> +<!-- show priorities helper --> +<xsl:template name="helpPriorities"> + <span> + <xsl:attribute name="class">b-1</xsl:attribute> +    + </span> P1 + <span> + <xsl:attribute name="class">b-2</xsl:attribute> +    + </span> P2 + <span> + <xsl:attribute name="class">b-3</xsl:attribute> +    + </span> P3 + <span> + <xsl:attribute name="class">b-4</xsl:attribute> +    + </span> Exp. +</xsl:template> + +<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> +<!-- display the details of a bug --> +<xsl:template name="display-bug" > + <xsl:param name="b-t" select="''" /> + <xsl:param name="bug-id" select="''" /> + <xsl:param name="which-list" select="''" /> + <div class="bb"> + <a> + <xsl:attribute name="href"></xsl:attribute> + <xsl:attribute name="onclick">showbug('b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" />','<xsl:value-of select="$which-list" />');return false;</xsl:attribute> + <span> + <xsl:attribute name="class">b-<xsl:value-of select="@priority"/></xsl:attribute> +    + </span> + <span class="b-t"><xsl:value-of select="@abbrev" />: </span> <xsl:value-of select="Class/Message" /> + </a> + <div style="display:none;"> + <xsl:attribute name="id">b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" />-ph-<xsl:value-of select="$which-list" /></xsl:attribute> + loading... + </div> + </div> +</xsl:template> + +<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> +<!-- main template for the list by category --> +<xsl:template name="list-by-category" > + <div id='list-by-category' class='data-box' style='display:none;'> + <xsl:call-template name="helpPriorities" /> + <xsl:variable name="unique-category" select="/BugCollection/BugCategory/@category"/> + <xsl:for-each select="$unique-category"> + <xsl:sort select="." order="ascending" /> + <xsl:call-template name="categories"> + <xsl:with-param name="category" select="." /> + </xsl:call-template> + </xsl:for-each> + </div> +</xsl:template> + +<xsl:template name="categories" > + <xsl:param name="category" select="''" /> + <xsl:variable name="category-count" + select="count(/BugCollection/BugInstance[@category=$category and not(@last)])" /> + <xsl:variable name="category-count-p1" + select="count(/BugCollection/BugInstance[@category=$category and @priority='1' and not(@last)])" /> + <xsl:variable name="category-count-p2" + select="count(/BugCollection/BugInstance[@category=$category and @priority='2' and not(@last)])" /> + <xsl:variable name="category-count-p3" + select="count(/BugCollection/BugInstance[@category=$category and @priority='3' and not(@last)])" /> + <xsl:variable name="category-count-p4" + select="count(/BugCollection/BugInstance[@category=$category and @priority='4' and not(@last)])" /> + <div class='ob'> + <div class='ob-t'> + <a> + <xsl:attribute name="href"></xsl:attribute> + <xsl:attribute name="onclick">toggle('category-<xsl:value-of select="$category" />');return false;</xsl:attribute> + <xsl:value-of select="/BugCollection/BugCategory[@category=$category]/Description" /> + (<xsl:value-of select="$category-count" />: + <span class='t-h'><xsl:value-of select="$category-count-p1" />/<xsl:value-of select="$category-count-p2" />/<xsl:value-of select="$category-count-p3" />/<xsl:value-of select="$category-count-p4" /></span>) + </a> + </div> + <div style="display:none;"> + <xsl:attribute name="id">category-<xsl:value-of select="$category" /></xsl:attribute> + <xsl:call-template name="list-by-category-and-code"> + <xsl:with-param name="category" select="$category" /> + </xsl:call-template> + </div> + </div> +</xsl:template> + +<xsl:template name="list-by-category-and-code" > + <xsl:param name="category" select="''" /> + <xsl:variable name="unique-code" select="/BugCollection/BugInstance[@category=$category and not(@last) and generate-id()= generate-id(key('lbc-code-key',concat(@category,@abbrev)))]/@abbrev" /> + <xsl:for-each select="$unique-code"> + <xsl:sort select="." order="ascending" /> + <xsl:call-template name="codes"> + <xsl:with-param name="category" select="$category" /> + <xsl:with-param name="code" select="." /> + </xsl:call-template> + </xsl:for-each> +</xsl:template> + +<xsl:template name="codes" > + <xsl:param name="category" select="''" /> + <xsl:param name="code" select="''" /> + <xsl:variable name="code-count" + select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and not(@last)])" /> + <xsl:variable name="code-count-p1" + select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='1' and not(@last)])" /> + <xsl:variable name="code-count-p2" + select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='2' and not(@last)])" /> + <xsl:variable name="code-count-p3" + select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='3' and not(@last)])" /> + <xsl:variable name="code-count-p4" + select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @priority='4' and not(@last)])" /> + <div class='ib-1'> + <div class="ib-1-t"> + <a> + <xsl:attribute name="href"></xsl:attribute> + <xsl:attribute name="onclick">toggle('category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />');return false;</xsl:attribute> + <xsl:value-of select="$code" />: <xsl:value-of select="/BugCollection/BugCode[@abbrev=$code]/Description" /> + (<xsl:value-of select="$code-count" />: + <span class='t-h'><xsl:value-of select="$code-count-p1" />/<xsl:value-of select="$code-count-p2" />/<xsl:value-of select="$code-count-p3" />/<xsl:value-of select="$code-count-p4" /></span>) + </a> + </div> + <div style="display:none;"> + <xsl:attribute name="id">category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" /></xsl:attribute> + <xsl:call-template name="list-by-category-and-code-and-bug"> + <xsl:with-param name="category" select="$category" /> + <xsl:with-param name="code" select="$code" /> + </xsl:call-template> + </div> + </div> +</xsl:template> + +<xsl:template name="list-by-category-and-code-and-bug" > + <xsl:param name="category" select="''" /> + <xsl:param name="code" select="''" /> + <xsl:variable name="unique-bug" select="/BugCollection/BugInstance[@category=$category and not(@last) and @abbrev=$code and generate-id()= generate-id(key('lbc-bug-key',concat(@category,@abbrev,@type)))]/@type" /> + <xsl:for-each select="$unique-bug"> + <xsl:sort select="." order="ascending" /> + <xsl:call-template name="bugs"> + <xsl:with-param name="category" select="$category" /> + <xsl:with-param name="code" select="$code" /> + <xsl:with-param name="bug" select="." /> + </xsl:call-template> + </xsl:for-each> +</xsl:template> + +<xsl:template name="bugs" > + <xsl:param name="category" select="''" /> + <xsl:param name="code" select="''" /> + <xsl:param name="bug" select="''" /> + <xsl:variable name="bug-count" + select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and not(@last)])" /> + <xsl:variable name="bug-count-p1" + select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='1' and not(@last)])" /> + <xsl:variable name="bug-count-p2" + select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='2' and not(@last)])" /> + <xsl:variable name="bug-count-p3" + select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='3' and not(@last)])" /> + <xsl:variable name="bug-count-p4" + select="count(/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and @priority='4' and not(@last)])" /> + <div class='ib-2'> + <div class='ib-2-t'> + <a> + <xsl:attribute name="href"></xsl:attribute> + <xsl:attribute name="onclick">toggle('category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />-and-bug-<xsl:value-of select="$bug" />');return false;</xsl:attribute> + <xsl:attribute name="onmouseout">popUp(event,'tip-<xsl:value-of select="$bug" />');</xsl:attribute> + <xsl:attribute name="onmouseover">popUp(event,'tip-<xsl:value-of select="$bug" />');</xsl:attribute> + <xsl:value-of select="/BugCollection/BugPattern[@category=$category and @abbrev=$code and @type=$bug]/ShortDescription" />   + (<xsl:value-of select="$bug-count" />: + <span class='t-h'><xsl:value-of select="$bug-count-p1" />/<xsl:value-of select="$bug-count-p2" />/<xsl:value-of select="$bug-count-p3" />/<xsl:value-of select="$bug-count-p4" /></span>) + </a> + </div> + <div style="display:none;"> + <xsl:attribute name="id">category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />-and-bug-<xsl:value-of select="$bug" /></xsl:attribute> + <xsl:variable name="cat-code-type">category-<xsl:value-of select="$category" />-and-code-<xsl:value-of select="$code" />-and-bug-<xsl:value-of select="$bug" /></xsl:variable> + <xsl:variable name="bug-id">b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" /></xsl:variable> + <xsl:for-each select="/BugCollection/BugInstance[@category=$category and @abbrev=$code and @type=$bug and not(@last)]"> + <xsl:call-template name="display-bug"> + <xsl:with-param name="b-t" select="@type" /> + <xsl:with-param name="bug-id" select="$bug-id" /> + <xsl:with-param name="which-list" select="'c'" /> + </xsl:call-template> + </xsl:for-each> + </div> + </div> +</xsl:template> + +<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> +<!-- main template for the list by package --> +<xsl:template name="list-by-package" > + <div id='list-by-package' class='data-box' style='display:none;'> + <xsl:call-template name="helpPriorities" /> + <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats[@total_bugs != '0']/@package"> + <xsl:sort select="." order="ascending" /> + <xsl:call-template name="packages"> + <xsl:with-param name="package" select="." /> + </xsl:call-template> + </xsl:for-each> + </div> +</xsl:template> + +<xsl:template name="packages" > + <xsl:param name="package" select="''" /> + <xsl:variable name="package-count-p1"> + <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_1 != '')">0</xsl:if> + <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_1 != ''"> + <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_1" /> + </xsl:if> + </xsl:variable> + <xsl:variable name="package-count-p2"> + <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_2 != '')">0</xsl:if> + <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_2 != ''"> + <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_2" /> + </xsl:if> + </xsl:variable> + <xsl:variable name="package-count-p3"> + <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_3 != '')">0</xsl:if> + <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_3 != ''"> + <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_3" /> + </xsl:if> + </xsl:variable> + <xsl:variable name="package-count-p4"> + <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_4 != '')">0</xsl:if> + <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_4 != ''"> + <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@priority_4" /> + </xsl:if> + </xsl:variable> + + <div class='ob'> + <div class='ob-t'> + <a> + <xsl:attribute name="href"></xsl:attribute> + <xsl:attribute name="onclick">toggle('package-<xsl:value-of select="$package" />');return false;</xsl:attribute> + <xsl:value-of select="$package" /> + (<xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/@total_bugs" />: + <span class='t-h'><xsl:value-of select="$package-count-p1" />/<xsl:value-of select="$package-count-p2" />/<xsl:value-of select="$package-count-p3" />/<xsl:value-of select="$package-count-p4" /></span>) + </a> + </div> + <div style="display:none;"> + <xsl:attribute name="id">package-<xsl:value-of select="$package" /></xsl:attribute> + <xsl:call-template name="list-by-package-and-class"> + <xsl:with-param name="package" select="$package" /> + </xsl:call-template> + </div> + </div> +</xsl:template> + +<xsl:template name="list-by-package-and-class" > + <xsl:param name="package" select="''" /> + <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@bugs != '0']/@class"> + <xsl:sort select="." order="ascending" /> + <xsl:call-template name="classes"> + <xsl:with-param name="package" select="$package" /> + <xsl:with-param name="class" select="." /> + </xsl:call-template> + </xsl:for-each> +</xsl:template> + +<xsl:template name="classes" > + <xsl:param name="package" select="''" /> + <xsl:param name="class" select="''" /> + <xsl:variable name="class-count" + select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@bugs" /> + + <xsl:variable name="class-count-p1"> + <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_1 != '')">0</xsl:if> + <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_1 != ''"> + <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_1" /> + </xsl:if> + </xsl:variable> + <xsl:variable name="class-count-p2"> + <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_2 != '')">0</xsl:if> + <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_2 != ''"> + <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_2" /> + </xsl:if> + </xsl:variable> + <xsl:variable name="class-count-p3"> + <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_3 != '')">0</xsl:if> + <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_3 != ''"> + <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_3" /> + </xsl:if> + </xsl:variable> + <xsl:variable name="class-count-p4"> + <xsl:if test="not(/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_4 != '')">0</xsl:if> + <xsl:if test="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_4 != ''"> + <xsl:value-of select="/BugCollection/FindBugsSummary/PackageStats[@package=$package]/ClassStats[@class=$class and @bugs != '0']/@priority_4" /> + </xsl:if> + </xsl:variable> + + <div class='ib-1'> + <div class="ib-1-t"> + <a> + <xsl:attribute name="href"></xsl:attribute> + <xsl:attribute name="onclick">toggle('package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />');return false;</xsl:attribute> + <xsl:value-of select="$class" /> (<xsl:value-of select="$class-count" />: + <span class='t-h'><xsl:value-of select="$class-count-p1" />/<xsl:value-of select="$class-count-p2" />/<xsl:value-of select="$class-count-p3" />/<xsl:value-of select="$class-count-p4" /></span>) + </a> + </div> + <div style="display:none;"> + <xsl:attribute name="id">package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" /></xsl:attribute> + <xsl:call-template name="list-by-package-and-class-and-bug"> + <xsl:with-param name="package" select="$package" /> + <xsl:with-param name="class" select="$class" /> + </xsl:call-template> + </div> + </div> +</xsl:template> + +<xsl:template name="list-by-package-and-class-and-bug" > + <xsl:param name="package" select="''" /> + <xsl:param name="class" select="''" /> + <xsl:variable name="unique-class-bugs" select="/BugCollection/BugInstance[not(@last) and Class[position()=1 and @classname=$class] and generate-id() = generate-id(key('lbp-class-b-t',concat(Class/@classname,@type)))]/@type" /> + + <xsl:for-each select="$unique-class-bugs"> + <xsl:sort select="." order="ascending" /> + <xsl:call-template name="class-bugs"> + <xsl:with-param name="package" select="$package" /> + <xsl:with-param name="class" select="$class" /> + <xsl:with-param name="type" select="." /> + </xsl:call-template> + </xsl:for-each> +</xsl:template> + +<xsl:template name="class-bugs" > + <xsl:param name="package" select="''" /> + <xsl:param name="class" select="''" /> + <xsl:param name="type" select="''" /> + <xsl:variable name="bug-count" + select="count(/BugCollection/BugInstance[@type=$type and not(@last) and Class[position()=1 and @classname=$class]])" /> + <div class='ib-2'> + <div class='ib-2-t'> + <a> + <xsl:attribute name="href"></xsl:attribute> + <xsl:attribute name="onclick">toggle('package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />-and-type-<xsl:value-of select="$type" />');return false;</xsl:attribute> + <xsl:attribute name="onmouseout">popUp(event,'tip-<xsl:value-of select="$type" />')</xsl:attribute> + <xsl:attribute name="onmouseover">popUp(event,'tip-<xsl:value-of select="$type" />')</xsl:attribute> + <xsl:value-of select="/BugCollection/BugPattern[@type=$type]/ShortDescription" />   + (<xsl:value-of select="$bug-count" />) + </a> + </div> + <div style="display:none;"> + <xsl:attribute name="id">package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />-and-type-<xsl:value-of select="$type" /></xsl:attribute> + <xsl:variable name="package-class-type">package-<xsl:value-of select="$package" />-and-class-<xsl:value-of select="$class" />-and-type-<xsl:value-of select="$type" /></xsl:variable> + <xsl:variable name="bug-id">b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" /></xsl:variable> + <xsl:for-each select="/BugCollection/BugInstance[@type=$type and not(@last) and Class[position()=1 and @classname=$class]]"> + <xsl:call-template name="display-bug"> + <xsl:with-param name="b-t" select="@type" /> + <xsl:with-param name="bug-id" select="$bug-id" /> + <xsl:with-param name="which-list" select="'p'" /> + </xsl:call-template> + </xsl:for-each> + </div> + </div> +</xsl:template> + +</xsl:transform> diff --git a/lib/findbugs/xsl/plain.xsl b/lib/findbugs/xsl/plain.xsl index d9dfaa3..80fff8d 100644 --- a/lib/findbugs/xsl/plain.xsl +++ b/lib/findbugs/xsl/plain.xsl @@ -21,20 +21,20 @@ <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output - method="html" + method="xml" omit-xml-declaration="yes" standalone="yes" - doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" - doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" + doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" + doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" indent="yes" encoding="UTF-8"/> -<!--xsl:key name="bug-category-key" match="/BugCollection/BugInstance" use="@category"/--> - <xsl:variable name="bugTableHeader"> <tr class="tableheader"> <th align="left">Warning</th> + <th align="left">Priority</th> <th align="left">Details</th> </tr> </xsl:variable> @@ -68,18 +68,26 @@ </head> <xsl:variable name="unique-catkey" select="/BugCollection/BugCategory/@category"/> - <!--xsl:variable name="unique-catkey" select="/BugCollection/BugInstance[generate-id() = generate-id(key('bug-category-key',@category))]/@category"/--> - + <body> <h1>FindBugs Report</h1> + <p>Produced using <a href="http://findbugs.sourceforge.net">FindBugs</a> <xsl:value-of select="/BugCollection/@version"/>.</p> + <p>Project: + <xsl:choose> + <xsl:when test='string-length(/BugCollection/Project/@projectName)>0'><xsl:value-of select="/BugCollection/Project/@projectName" /></xsl:when> + <xsl:otherwise><xsl:value-of select="/BugCollection/Project/@filename" /></xsl:otherwise> + </xsl:choose> + </p> + <h2>Metrics</h2> + <xsl:apply-templates select="/BugCollection/FindBugsSummary"/> - <h2>Summary</h2>
- <table width="500" cellpadding="5" cellspacing="2">
- <tr class="tableheader">
- <th align="left">Warning Type</th>
- <th align="right">Number</th>
- </tr>
+ <h2>Summary</h2> + <table width="500" cellpadding="5" cellspacing="2"> + <tr class="tableheader"> + <th align="left">Warning Type</th> + <th align="right">Number</th> + </tr> <xsl:for-each select="$unique-catkey"> <xsl:sort select="." order="ascending"/> @@ -93,7 +101,7 @@ <tr class="{$styleclass}"> <td><a href="#Warnings_{$catkey}"><xsl:value-of select="$catdesc"/> Warnings</a></td> - <td align="right"><xsl:value-of select="count(/BugCollection/BugInstance[@category=$catkey])"/></td> + <td align="right"><xsl:value-of select="count(/BugCollection/BugInstance[(@category=$catkey) and (not(@last))])"/></td> </tr> </xsl:for-each> @@ -102,16 +110,16 @@ <xsl:otherwise>tablerow1</xsl:otherwise> </xsl:choose> </xsl:variable> - <tr class="{$styleclass}">
- <td><b>Total</b></td>
- <td align="right"><b><xsl:value-of select="count(/BugCollection/BugInstance)"/></b></td>
- </tr>
- </table>
- <p><br/><br/></p>
+ <tr class="{$styleclass}"> + <td><b>Total</b></td> + <td align="right"><b><xsl:value-of select="count(/BugCollection/BugInstance[not(@last)])"/></b></td> + </tr> + </table> + <p><br/><br/></p> <h1>Warnings</h1> - <p>Click on each warning link to see a full description of the issue, and
+ <p>Click on each warning link to see a full description of the issue, and details of how to resolve it.</p> <xsl:for-each select="$unique-catkey"> @@ -120,12 +128,12 @@ <xsl:variable name="catdesc" select="/BugCollection/BugCategory[@category=$catkey]/Description"/> <xsl:call-template name="generateWarningTable"> - <xsl:with-param name="warningSet" select="/BugCollection/BugInstance[@category=$catkey]"/> + <xsl:with-param name="warningSet" select="/BugCollection/BugInstance[(@category=$catkey) and (not(@last))]"/> <xsl:with-param name="sectionTitle"><xsl:value-of select="$catdesc"/> Warnings</xsl:with-param> <xsl:with-param name="sectionId">Warnings_<xsl:value-of select="$catkey"/></xsl:with-param> </xsl:call-template> </xsl:for-each> -
+ <p><br/><br/></p> <h1><a name="Details">Warning Types</a></h1> @@ -138,33 +146,41 @@ </html> </xsl:template> -<xsl:template match="BugInstance"> +<xsl:template match="BugInstance[not(@last)]"> <xsl:variable name="warningId"><xsl:value-of select="generate-id()"/></xsl:variable> <tr class="tablerow{position() mod 2}"> <td width="20%" valign="top"> <a href="#{@type}"><xsl:value-of select="ShortMessage"/></a> </td> - <td width="80%"> - <p><xsl:value-of select="LongMessage"/><br/><br/>
-
- <!-- add source filename and line number(s), if any -->
- <xsl:if test="SourceLine">
- <br/>In file <xsl:value-of select="SourceLine/@sourcefile"/>,
- <xsl:choose>
- <xsl:when test="SourceLine/@start = SourceLine/@end">
- line <xsl:value-of select="SourceLine/@start"/>
- </xsl:when>
- <xsl:otherwise>
- lines <xsl:value-of select="SourceLine/@start"/>
- to <xsl:value-of select="SourceLine/@end"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
-
- <xsl:for-each select="./*/Message">
- <br/><xsl:value-of select="text()"/>
- </xsl:for-each>
+ <td width="10%" valign="top"> + <xsl:choose> + <xsl:when test="@priority = 1">High</xsl:when> + <xsl:when test="@priority = 2">Medium</xsl:when> + <xsl:when test="@priority = 3">Low</xsl:when> + <xsl:otherwise>Unknown</xsl:otherwise> + </xsl:choose> + </td> + <td width="70%"> + <p><xsl:value-of select="LongMessage"/><br/><br/> + + <!-- add source filename and line number(s), if any --> + <xsl:if test="SourceLine"> + <br/>In file <xsl:value-of select="SourceLine/@sourcefile"/>, + <xsl:choose> + <xsl:when test="SourceLine/@start = SourceLine/@end"> + line <xsl:value-of select="SourceLine/@start"/> + </xsl:when> + <xsl:otherwise> + lines <xsl:value-of select="SourceLine/@start"/> + to <xsl:value-of select="SourceLine/@end"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + + <xsl:for-each select="./*/Message"> + <br/><xsl:value-of select="text()"/> + </xsl:for-each> </p> </td> </tr> @@ -172,7 +188,7 @@ <xsl:template match="BugPattern"> <h2><a name="{@type}"><xsl:value-of select="ShortDescription"/></a></h2> - <xsl:value-of select="Details" disable-output-escaping="yes"/>
+ <xsl:value-of select="Details" disable-output-escaping="yes"/> <p><br/><br/></p> </xsl:template> @@ -183,20 +199,108 @@ <h2><a name="{$sectionId}"><xsl:value-of select="$sectionTitle"/></a></h2> <table class="warningtable" width="100%" cellspacing="2" cellpadding="5"> - <xsl:copy-of select="$bugTableHeader"/>
- <xsl:choose>
+ <xsl:copy-of select="$bugTableHeader"/> + <xsl:choose> <xsl:when test="count($warningSet) > 0"> <xsl:apply-templates select="$warningSet"> + <xsl:sort select="@priority"/> <xsl:sort select="@abbrev"/> <xsl:sort select="Class/@classname"/> - </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <tr><td colspan="2"><p><i>None</i></p></td></tr>
- </xsl:otherwise>
+ </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <tr><td colspan="2"><p><i>None</i></p></td></tr> + </xsl:otherwise> </xsl:choose> - </table>
+ </table> <p><br/><br/></p> </xsl:template> -</xsl:stylesheet>
\ No newline at end of file +<xsl:template match="FindBugsSummary"> + <xsl:variable name="kloc" select="@total_size div 1000.0"/> + <xsl:variable name="format" select="'#######0.00'"/> + + <p><xsl:value-of select="@total_size"/> lines of code analyzed, + in <xsl:value-of select="@total_classes"/> classes, + in <xsl:value-of select="@num_packages"/> packages.</p> + <table width="500" cellpadding="5" cellspacing="2"> + <tr class="tableheader"> + <th align="left">Metric</th> + <th align="right">Total</th> + <th align="right">Density*</th> + </tr> + <tr class="tablerow0"> + <td>High Priority Warnings</td> + <td align="right"><xsl:value-of select="@priority_1"/></td> + <td align="right"> + <xsl:choose> + <xsl:when test= "number($kloc) > 0.0"> + <xsl:value-of select="format-number(@priority_1 div $kloc, $format)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="format-number(0.0, $format)"/> + </xsl:otherwise> + </xsl:choose> + </td> + </tr> + <tr class="tablerow1"> + <td>Medium Priority Warnings</td> + <td align="right"><xsl:value-of select="@priority_2"/></td> + <td align="right"> + <xsl:choose> + <xsl:when test= "number($kloc) > 0.0"> + <xsl:value-of select="format-number(@priority_2 div $kloc, $format)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="format-number(0.0, $format)"/> + </xsl:otherwise> + </xsl:choose> + </td> + </tr> + + <xsl:choose> + <xsl:when test="@priority_3"> + <tr class="tablerow1"> + <td>Low Priority Warnings</td> + <td align="right"><xsl:value-of select="@priority_3"/></td> + <td align="right"> + <xsl:choose> + <xsl:when test= "number($kloc) > 0.0"> + <xsl:value-of select="format-number(@priority_3 div $kloc, $format)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="format-number(0.0, $format)"/> + </xsl:otherwise> + </xsl:choose> + </td> + </tr> + <xsl:variable name="totalClass" select="tablerow0"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="totalClass" select="tablerow1"/> + </xsl:otherwise> + </xsl:choose> + + <tr class="$totalClass"> + <td><b>Total Warnings</b></td> + <td align="right"><b><xsl:value-of select="@total_bugs"/></b></td> + <td align="right"> + <b> + <xsl:choose> + <xsl:when test= "number($kloc) > 0.0"> + <xsl:value-of select="format-number(@total_bugs div $kloc, $format)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="format-number(0.0, $format)"/> + </xsl:otherwise> + </xsl:choose> + </b> + </td> + </tr> + </table> + <p><i>(* Defects per Thousand lines of non-commenting source statements)</i></p> + <p><br/><br/></p> + +</xsl:template> + +</xsl:stylesheet> diff --git a/lib/findbugs/xsl/summary.xsl b/lib/findbugs/xsl/summary.xsl index 6bbe950..faf0131 100644 --- a/lib/findbugs/xsl/summary.xsl +++ b/lib/findbugs/xsl/summary.xsl @@ -1,7 +1,11 @@ <?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
-<xsl:output method="html"/>
+<xsl:output
+ method="xml" indent="yes"
+ doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ encoding="UTF-8"/>
<xsl:param name="PAGE.TITLE" select="'Findbugs Summary Statistics'" />
<xsl:param name="PAGE.FONT" select="'Arial'" />
@@ -35,18 +39,27 @@ <!-- This template drives the rest of the output -->
<xsl:template match="/" >
<html>
- <!-- JEditorPane gets really angry if it sees this -->
- <!--<head><title><xsl:value-of select="$PAGE.TITLE" /></title></head> -->
+ <!-- JEditorPane gets really angry if it sees this
+ WWP: Sorry, this needs to be explained better. Not a valid HTML document without a head.
+ -->
+ <head><title><xsl:value-of select="$PAGE.TITLE" /></title></head>
<body>
- <h1><center><xsl:value-of select="$SUMMARY.HEADER" /></center></h1>
- <h2><center><xsl:value-of select="$SUMMARY.LABEL" />
- <i><xsl:value-of select="//FindBugsSummary/@timestamp" /></i></center></h2>
+ <h1 align="center"><a href="http://findbugs.sourceforge.net"><xsl:value-of select="$SUMMARY.HEADER" /></a></h1>
+ <h2 align="center"> Analysis for
+ <xsl:choose>
+ <xsl:when test='string-length(/BugCollection/Project/@projectName)>0'>
+ <xsl:value-of select="/BugCollection/Project/@projectName" /></xsl:when>
+ <xsl:otherwise><xsl:value-of select="/BugCollection/Project/@filename" /></xsl:otherwise>
+ </xsl:choose>
+ </h2>
+ <h2 align="center"><xsl:value-of select="$SUMMARY.LABEL" />
+ <i><xsl:value-of select="//FindBugsSummary/@timestamp" /></i></h2>
<xsl:apply-templates select="//FindBugsSummary" />
<br/>
- <center>
+ <p align="center">
<font face="{$PAGE.FONT}" size="6"><xsl:value-of select="$PACKAGE.HEADER" /></font>
<br/><font face="{$PAGE.FONT}" size="4"><i>(<xsl:value-of select="$PACKAGE.SORT.LABEL"/>)</i></font>
- </center>
+ </p>
<xsl:for-each select="//FindBugsSummary/PackageStats">
<xsl:sort select="@total_bugs" data-type="number" order="descending" />
<xsl:apply-templates select="." />
@@ -88,7 +101,7 @@ </xsl:template>
<xsl:template match="FindBugsSummary" >
- <center><table width="{$TABLE.WIDTH}" border="1">
+ <table width="{$TABLE.WIDTH}" border="1" align="center">
<xsl:call-template name="table_header" />
<xsl:call-template name="status_table_row">
@@ -125,7 +138,7 @@ </xsl:call-template>
</font></td>
</tr>
- </table></center>
+ </table>
</xsl:template>
@@ -168,8 +181,8 @@ </xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <center><h2><xsl:value-of select="$PACKAGE.LABEL"/><i><font color='green'><xsl:value-of select="$package-name" /></font></i></h2></center>
- <center><table width="{$TABLE.WIDTH}" border="1">
+ <h2 align="center"><xsl:value-of select="$PACKAGE.LABEL"/><i><font color='green'><xsl:value-of select="$package-name" /></font></i></h2>
+ <table width="{$TABLE.WIDTH}" border="1" align="center">
<xsl:call-template name="table_header" />
<xsl:call-template name="status_table_row">
@@ -199,7 +212,7 @@ </table>
<xsl:if test="@total_bugs > 0">
- <table width="{$TABLE.WIDTH}" border="0">
+ <table width="{$TABLE.WIDTH}" border="0" align="center">
<xsl:variable name="max_bugs">
<xsl:for-each select="ClassStats">
<xsl:sort select="@bugs" data-type="number" order="descending"/>
@@ -233,7 +246,6 @@ </table>
</xsl:if>
- </center>
<br/>
</xsl:template>
|