Create an intermediate summary xml file to ease summary report

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@293488 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
carlos 2005-10-04 02:04:12 +00:00
parent 161d2ff233
commit 325bc7cdb3
4 changed files with 37 additions and 22 deletions

View File

@ -230,8 +230,14 @@
<goal name="checkstyle:report-internal" description="Generate xdocs from checkstyle xml report"> <goal name="checkstyle:report-internal" description="Generate xdocs from checkstyle xml report">
<mkdir dir="${maven.gen.docs}/checkstyle"/> <mkdir dir="${maven.gen.docs}/checkstyle"/>
<style <style
in="${maven.checkstyle.output.xml}" in="${maven.checkstyle.output.xml}"
out="${maven.checkstyle.output.summary.xml}"
style="${plugin.resources}/checkstyle-summary.xsl"/>
<style
in="${maven.checkstyle.output.summary.xml}"
out="${maven.gen.docs}/checkstyle/index.xml" out="${maven.gen.docs}/checkstyle/index.xml"
style="${plugin.resources}/checkstyle.xsl"/> style="${plugin.resources}/checkstyle.xsl"/>

View File

@ -36,3 +36,4 @@ maven.checkstyle.usefile = true
# Output files # Output files
maven.checkstyle.output.xml = ${maven.checkstyle.dir}/checkstyle-raw-report.xml maven.checkstyle.output.xml = ${maven.checkstyle.dir}/checkstyle-raw-report.xml
maven.checkstyle.output.txt = ${maven.checkstyle.dir}/checkstyle-raw-report.txt maven.checkstyle.output.txt = ${maven.checkstyle.dir}/checkstyle-raw-report.txt
maven.checkstyle.output.summary.xml = ${maven.checkstyle.dir}/checkstyle-summary-report.xml

View File

@ -19,8 +19,8 @@
--> -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" /> <xsl:output method="xml" indent="yes"/>
<xsl:key name="stvalkey" match="//error" use="@message" /> <xsl:key name="errors-by-message" match="//error" use="@message" />
<xsl:template match="/"> <xsl:template match="/">
<document> <document>
@ -54,7 +54,7 @@
<table summary="Report summary"> <table summary="Report summary">
<thead> <thead>
<tr> <tr>
<th>Files</th> <th style="width:75px">Total</th>
<th style="width:75px">Infos</th> <th style="width:75px">Infos</th>
<th style="width:75px">Warnings</th> <th style="width:75px">Warnings</th>
<th style="width:75px">Errors</th> <th style="width:75px">Errors</th>
@ -62,22 +62,22 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td><xsl:value-of select="count(//file)" /></td> <td><xsl:value-of select="count(//error)" /></td>
<td><xsl:value-of select="count(//file/error[@severity='info'])" /></td> <td><xsl:value-of select="count(//error[@severity='info'])" /></td>
<td><xsl:value-of select="count(//file/error[@severity='warning'])" /></td> <td><xsl:value-of select="count(//error[@severity='warning'])" /></td>
<td><xsl:value-of select="count(//file/error[@severity='error'])" /></td> <td><xsl:value-of select="count(//error[@severity='error'])" /></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</section> </section>
<xsl:apply-templates select="." mode="count"> <xsl:apply-templates select="." mode="display">
<xsl:with-param name="severity">error</xsl:with-param> <xsl:with-param name="severity">error</xsl:with-param>
</xsl:apply-templates> </xsl:apply-templates>
<xsl:apply-templates select="." mode="count"> <xsl:apply-templates select="." mode="display">
<xsl:with-param name="severity">warning</xsl:with-param> <xsl:with-param name="severity">warning</xsl:with-param>
</xsl:apply-templates> </xsl:apply-templates>
<xsl:apply-templates select="." mode="count"> <xsl:apply-templates select="." mode="display">
<xsl:with-param name="severity">info</xsl:with-param> <xsl:with-param name="severity">info</xsl:with-param>
</xsl:apply-templates> </xsl:apply-templates>
@ -85,33 +85,33 @@
</document> </document>
</xsl:template> </xsl:template>
<xsl:template match="/" mode="count"> <xsl:template match="/" mode="display">
<xsl:param name="severity"/> <xsl:param name="severity"/>
<xsl:element name="section"> <xsl:element name="section">
<xsl:attribute name="name">Checkstyle <xsl:value-of select="$severity"/> Summary</xsl:attribute> <xsl:attribute name="name">Checkstyle <xsl:value-of select="$severity"/> summary</xsl:attribute>
<table> <table>
<tr> <tr>
<th>Error</th> <th>Error</th>
<th>Count</th> <th>Count</th>
</tr> </tr>
<xsl:for-each select="//error[@severity=$severity]" > <xsl:for-each select="//error[@severity=$severity]" >
<xsl:variable name="tmp" > <xsl:sort select="@count" order="descending"/>
<xsl:value-of select="./@message" /> <xsl:sort select="@message"/>
</xsl:variable>
<xsl:if test="generate-id(.) = generate-id(key('stvalkey',$tmp)[1])">
<tr> <tr>
<td><xsl:value-of select="$tmp" /></td> <td><xsl:value-of select="@message" /></td>
<td><xsl:value-of select="count(key('stvalkey',$tmp))" /></td> <td><xsl:value-of select="@count" /></td>
</tr> </tr>
</xsl:if>
</xsl:for-each> </xsl:for-each>
</table> </table>
</xsl:element> </xsl:element>
</xsl:template> </xsl:template>
<xsl:template match="text()" /> <xsl:template match="text()" />
</xsl:stylesheet> </xsl:stylesheet>

View File

@ -161,6 +161,14 @@
Defaults to <code>${maven.checkstyle.dir}/checkstyle-raw-report.txt</code>. Defaults to <code>${maven.checkstyle.dir}/checkstyle-raw-report.txt</code>.
</td> </td>
</tr> </tr>
<tr>
<td>maven.checkstyle.output.summary.xml</td>
<td>Yes</td>
<td>
Output file where the xml summary report is written.
Defaults to <code>${maven.checkstyle.dir}/checkstyle-summary-report.xml</code>.
</td>
</tr>
</table> </table>
</section> </section>
</body> </body>