|
@@ -0,0 +1,262 @@
|
|
1
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+<!--
|
|
3
|
+ FindBugs - Find bugs in Java programs
|
|
4
|
+ Copyright (C) 2004,2005 University of Maryland
|
|
5
|
+ Copyright (C) 2005, Chris Nappin
|
|
6
|
+
|
|
7
|
+ This library is free software; you can redistribute it and/or
|
|
8
|
+ modify it under the terms of the GNU Lesser General Public
|
|
9
|
+ License as published by the Free Software Foundation; either
|
|
10
|
+ version 2.1 of the License, or (at your option) any later version.
|
|
11
|
+
|
|
12
|
+ This library is distributed in the hope that it will be useful,
|
|
13
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15
|
+ Lesser General Public License for more details.
|
|
16
|
+
|
|
17
|
+ You should have received a copy of the GNU Lesser General Public
|
|
18
|
+ License along with this library; if not, write to the Free Software
|
|
19
|
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
20
|
+-->
|
|
21
|
+<xsl:stylesheet version="1.0"
|
|
22
|
+ xmlns="http://www.w3.org/1999/xhtml"
|
|
23
|
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
24
|
+
|
|
25
|
+<xsl:output
|
|
26
|
+ method="xml"
|
|
27
|
+ omit-xml-declaration="yes"
|
|
28
|
+ standalone="yes"
|
|
29
|
+ doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
|
|
30
|
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
31
|
+ indent="yes"
|
|
32
|
+ encoding="UTF-8"/>
|
|
33
|
+
|
|
34
|
+<!--xsl:key name="bug-category-key" match="/BugCollection/BugInstance" use="@category"/-->
|
|
35
|
+
|
|
36
|
+<xsl:variable name="bugTableHeader">
|
|
37
|
+ <tr class="tableheader">
|
|
38
|
+ <th align="left">Warning</th>
|
|
39
|
+ <th align="left">Priority</th>
|
|
40
|
+ <th align="left">Details</th>
|
|
41
|
+ </tr>
|
|
42
|
+</xsl:variable>
|
|
43
|
+
|
|
44
|
+<xsl:template match="/">
|
|
45
|
+ <html>
|
|
46
|
+ <head>
|
|
47
|
+ <title>FindBugs Report</title>
|
|
48
|
+ <style type="text/css">
|
|
49
|
+ .tablerow0 {
|
|
50
|
+ background: #EEEEEE;
|
|
51
|
+ }
|
|
52
|
+
|
|
53
|
+ .tablerow1 {
|
|
54
|
+ background: white;
|
|
55
|
+ }
|
|
56
|
+
|
|
57
|
+ .detailrow0 {
|
|
58
|
+ background: #EEEEEE;
|
|
59
|
+ }
|
|
60
|
+
|
|
61
|
+ .detailrow1 {
|
|
62
|
+ background: white;
|
|
63
|
+ }
|
|
64
|
+
|
|
65
|
+ .tableheader {
|
|
66
|
+ background: #b9b9fe;
|
|
67
|
+ font-size: larger;
|
|
68
|
+ }
|
|
69
|
+ </style>
|
|
70
|
+ </head>
|
|
71
|
+
|
|
72
|
+ <xsl:variable name="unique-catkey" select="/BugCollection/BugCategory/@category"/>
|
|
73
|
+ <!--xsl:variable name="unique-catkey" select="/BugCollection/BugInstance[generate-id() = generate-id(key('bug-category-key',@category))]/@category"/-->
|
|
74
|
+
|
|
75
|
+ <body>
|
|
76
|
+ <h2>Metrics</h2>
|
|
77
|
+ <xsl:apply-templates select="/BugCollection/FindBugsSummary"/>
|
|
78
|
+
|
|
79
|
+ <h2>Summary</h2>
|
|
80
|
+ <table width="500" cellpadding="5" cellspacing="2">
|
|
81
|
+ <tr class="tableheader">
|
|
82
|
+ <th align="left">Warning Type</th>
|
|
83
|
+ <th align="right">Number</th>
|
|
84
|
+ </tr>
|
|
85
|
+
|
|
86
|
+ <xsl:for-each select="$unique-catkey">
|
|
87
|
+ <xsl:sort select="." order="ascending"/>
|
|
88
|
+ <xsl:variable name="catkey" select="."/>
|
|
89
|
+ <xsl:variable name="catdesc" select="/BugCollection/BugCategory[@category=$catkey]/Description"/>
|
|
90
|
+ <xsl:variable name="styleclass">
|
|
91
|
+ <xsl:choose><xsl:when test="position() mod 2 = 1">tablerow0</xsl:when>
|
|
92
|
+ <xsl:otherwise>tablerow1</xsl:otherwise>
|
|
93
|
+ </xsl:choose>
|
|
94
|
+ </xsl:variable>
|
|
95
|
+
|
|
96
|
+ <tr class="{$styleclass}">
|
|
97
|
+ <td><a href="#Warnings_{$catkey}"><xsl:value-of select="$catdesc"/> Warnings</a></td>
|
|
98
|
+ <td align="right"><xsl:value-of select="count(/BugCollection/BugInstance[@category=$catkey])"/></td>
|
|
99
|
+ </tr>
|
|
100
|
+ </xsl:for-each>
|
|
101
|
+
|
|
102
|
+ <xsl:variable name="styleclass">
|
|
103
|
+ <xsl:choose><xsl:when test="count($unique-catkey) mod 2 = 0">tablerow0</xsl:when>
|
|
104
|
+ <xsl:otherwise>tablerow1</xsl:otherwise>
|
|
105
|
+ </xsl:choose>
|
|
106
|
+ </xsl:variable>
|
|
107
|
+ <tr class="{$styleclass}">
|
|
108
|
+ <td><b>Total</b></td>
|
|
109
|
+ <td align="right"><b><xsl:value-of select="count(/BugCollection/BugInstance)"/></b></td>
|
|
110
|
+ </tr>
|
|
111
|
+ </table>
|
|
112
|
+ <p><br/><br/></p>
|
|
113
|
+
|
|
114
|
+ <h1>Warnings</h1>
|
|
115
|
+
|
|
116
|
+ <p>Click on each warning link to see a full description of the issue, and
|
|
117
|
+ details of how to resolve it.</p>
|
|
118
|
+
|
|
119
|
+ <xsl:for-each select="$unique-catkey">
|
|
120
|
+ <xsl:sort select="." order="ascending"/>
|
|
121
|
+ <xsl:variable name="catkey" select="."/>
|
|
122
|
+ <xsl:variable name="catdesc" select="/BugCollection/BugCategory[@category=$catkey]/Description"/>
|
|
123
|
+
|
|
124
|
+ <xsl:call-template name="generateWarningTable">
|
|
125
|
+ <xsl:with-param name="warningSet" select="/BugCollection/BugInstance[@category=$catkey]"/>
|
|
126
|
+ <xsl:with-param name="sectionTitle"><xsl:value-of select="$catdesc"/> Warnings</xsl:with-param>
|
|
127
|
+ <xsl:with-param name="sectionId">Warnings_<xsl:value-of select="$catkey"/></xsl:with-param>
|
|
128
|
+ </xsl:call-template>
|
|
129
|
+ </xsl:for-each>
|
|
130
|
+
|
|
131
|
+ <p><br/><br/></p>
|
|
132
|
+ <h1><a name="Details">Warning Types</a></h1>
|
|
133
|
+
|
|
134
|
+ <xsl:apply-templates select="/BugCollection/BugPattern">
|
|
135
|
+ <xsl:sort select="@abbrev"/>
|
|
136
|
+ <xsl:sort select="ShortDescription"/>
|
|
137
|
+ </xsl:apply-templates>
|
|
138
|
+
|
|
139
|
+ </body>
|
|
140
|
+ </html>
|
|
141
|
+</xsl:template>
|
|
142
|
+
|
|
143
|
+<xsl:template match="BugInstance">
|
|
144
|
+ <xsl:variable name="warningId"><xsl:value-of select="generate-id()"/></xsl:variable>
|
|
145
|
+
|
|
146
|
+ <tr class="tablerow{position() mod 2}">
|
|
147
|
+ <td width="20%" valign="top">
|
|
148
|
+ <a href="#{@type}"><xsl:value-of select="ShortMessage"/></a>
|
|
149
|
+ </td>
|
|
150
|
+ <td width="10%" valign="top">
|
|
151
|
+ <xsl:choose>
|
|
152
|
+ <xsl:when test="@priority = 1">High</xsl:when>
|
|
153
|
+ <xsl:when test="@priority = 2">Medium</xsl:when>
|
|
154
|
+ <xsl:when test="@priority = 3">Low</xsl:when>
|
|
155
|
+ <xsl:otherwise>Unknown</xsl:otherwise>
|
|
156
|
+ </xsl:choose>
|
|
157
|
+ </td>
|
|
158
|
+ <td width="70%">
|
|
159
|
+ <p><xsl:value-of select="LongMessage"/><br/><br/>
|
|
160
|
+
|
|
161
|
+ <!-- add source filename and line number(s), if any -->
|
|
162
|
+ <xsl:if test="SourceLine">
|
|
163
|
+ <br/>In file <xsl:value-of select="SourceLine/@sourcefile"/>,
|
|
164
|
+ <xsl:choose>
|
|
165
|
+ <xsl:when test="SourceLine/@start = SourceLine/@end">
|
|
166
|
+ line <xsl:value-of select="SourceLine/@start"/>
|
|
167
|
+ </xsl:when>
|
|
168
|
+ <xsl:otherwise>
|
|
169
|
+ lines <xsl:value-of select="SourceLine/@start"/>
|
|
170
|
+ to <xsl:value-of select="SourceLine/@end"/>
|
|
171
|
+ </xsl:otherwise>
|
|
172
|
+ </xsl:choose>
|
|
173
|
+ </xsl:if>
|
|
174
|
+
|
|
175
|
+ <xsl:for-each select="./*/Message">
|
|
176
|
+ <br/><xsl:value-of select="text()"/>
|
|
177
|
+ </xsl:for-each>
|
|
178
|
+ </p>
|
|
179
|
+ </td>
|
|
180
|
+ </tr>
|
|
181
|
+</xsl:template>
|
|
182
|
+
|
|
183
|
+<xsl:template match="BugPattern">
|
|
184
|
+ <h2><a name="{@type}"><xsl:value-of select="ShortDescription"/></a></h2>
|
|
185
|
+ <xsl:value-of select="Details" disable-output-escaping="yes"/>
|
|
186
|
+ <p><br/><br/></p>
|
|
187
|
+</xsl:template>
|
|
188
|
+
|
|
189
|
+<xsl:template name="generateWarningTable">
|
|
190
|
+ <xsl:param name="warningSet"/>
|
|
191
|
+ <xsl:param name="sectionTitle"/>
|
|
192
|
+ <xsl:param name="sectionId"/>
|
|
193
|
+
|
|
194
|
+ <h2><a name="{$sectionId}"><xsl:value-of select="$sectionTitle"/></a></h2>
|
|
195
|
+ <table class="warningtable" width="100%" cellspacing="2" cellpadding="5">
|
|
196
|
+ <xsl:copy-of select="$bugTableHeader"/>
|
|
197
|
+ <xsl:choose>
|
|
198
|
+ <xsl:when test="count($warningSet) > 0">
|
|
199
|
+ <xsl:apply-templates select="$warningSet">
|
|
200
|
+ <xsl:sort select="@priority"/>
|
|
201
|
+ <xsl:sort select="@abbrev"/>
|
|
202
|
+ <xsl:sort select="Class/@classname"/>
|
|
203
|
+ </xsl:apply-templates>
|
|
204
|
+ </xsl:when>
|
|
205
|
+ <xsl:otherwise>
|
|
206
|
+ <tr><td colspan="2"><p><i>None</i></p></td></tr>
|
|
207
|
+ </xsl:otherwise>
|
|
208
|
+ </xsl:choose>
|
|
209
|
+ </table>
|
|
210
|
+ <p><br/><br/></p>
|
|
211
|
+</xsl:template>
|
|
212
|
+
|
|
213
|
+<xsl:template match="FindBugsSummary">
|
|
214
|
+ <xsl:variable name="kloc" select="@total_size div 1000.0"/>
|
|
215
|
+ <xsl:variable name="format" select="'#######0.00'"/>
|
|
216
|
+
|
|
217
|
+ <p><xsl:value-of select="@total_size"/> lines of code analysed,
|
|
218
|
+ in <xsl:value-of select="@total_classes"/> classes,
|
|
219
|
+ in <xsl:value-of select="@num_packages"/> packages.</p>
|
|
220
|
+ <table width="500" cellpadding="5" cellspacing="2">
|
|
221
|
+ <tr class="tableheader">
|
|
222
|
+ <th align="left">Metric</th>
|
|
223
|
+ <th align="right">Total</th>
|
|
224
|
+ <th align="right">Density*</th>
|
|
225
|
+ </tr>
|
|
226
|
+ <tr class="tablerow0">
|
|
227
|
+ <td>High Priority Warnings</td>
|
|
228
|
+ <td align="right"><xsl:value-of select="@priority_1"/></td>
|
|
229
|
+ <td align="right"><xsl:value-of select="format-number(@priority_1 div $kloc, $format)"/></td>
|
|
230
|
+ </tr>
|
|
231
|
+ <tr class="tablerow1">
|
|
232
|
+ <td>Medium Priority Warnings</td>
|
|
233
|
+ <td align="right"><xsl:value-of select="@priority_2"/></td>
|
|
234
|
+ <td align="right"><xsl:value-of select="format-number(@priority_2 div $kloc, $format)"/></td>
|
|
235
|
+ </tr>
|
|
236
|
+
|
|
237
|
+ <xsl:choose>
|
|
238
|
+ <xsl:when test="@priority_3">
|
|
239
|
+ <tr class="tablerow1">
|
|
240
|
+ <td>Low Priority Warnings</td>
|
|
241
|
+ <td align="right"><xsl:value-of select="@priority_3"/></td>
|
|
242
|
+ <td align="right"><xsl:value-of select="format-number(@priority_3 div $kloc, $format)"/></td>
|
|
243
|
+ </tr>
|
|
244
|
+ <xsl:variable name="totalClass" select="tablerow0"/>
|
|
245
|
+ </xsl:when>
|
|
246
|
+ <xsl:otherwise>
|
|
247
|
+ <xsl:variable name="totalClass" select="tablerow1"/>
|
|
248
|
+ </xsl:otherwise>
|
|
249
|
+ </xsl:choose>
|
|
250
|
+
|
|
251
|
+ <tr class="$totalClass">
|
|
252
|
+ <td><b>Total Warnings</b></td>
|
|
253
|
+ <td align="right"><b><xsl:value-of select="@total_bugs"/></b></td>
|
|
254
|
+ <td align="right"><b><xsl:value-of select="format-number(@total_bugs div $kloc, $format)"/></b></td>
|
|
255
|
+ </tr>
|
|
256
|
+ </table>
|
|
257
|
+ <p><i>(* Defects per Thousand lines of non-commenting source statetements)</i></p>
|
|
258
|
+ <p><br/><br/></p>
|
|
259
|
+
|
|
260
|
+</xsl:template>
|
|
261
|
+
|
|
262
|
+</xsl:stylesheet>
|