Added first cut of a checkstyle RSS feed. There's lot to improve but I'd like to gather some feedback before working more on this feature. It relies on the fact that RSS readers cache feed data previously read thus keeping an history of the feed content over time.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115584 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vmassol
2004-06-28 21:04:04 +00:00
parent 8797a42dff
commit a0457e79ac
6 changed files with 136 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
@@ -17,7 +18,6 @@
*/
-->
<!--
=============================================================================
Checkstyle plugin for Maven.
@@ -195,6 +195,19 @@
outputMode="xml"
prettyPrint="true"/>
<!-- Generate a RSS feed of the checktyle errors -->
<doc:jsl
input="${maven.build.dir}/checkstyle-raw-report.xml"
output="checkstyle.rss"
stylesheet="${plugin.resources}/checkstyle2rss.jsl"
encoding="${maven.docs.outputencoding}"
outputMode="xml"
prettyPrint="true"/>
<!-- Copy the RSS XML logo -->
<mkdir dir="${maven.docs.dest}"/>
<copy todir="${maven.docs.dest}/images" file="${plugin.resources}/images/rss.png"/>
</goal>
<!--

View File

@@ -23,7 +23,7 @@
<pomVersion>3</pomVersion>
<id>maven-checkstyle-plugin</id>
<name>Maven Checkstyle Plugin</name>
<currentVersion>2.4.2-SNAPSHOT</currentVersion>
<currentVersion>2.5-SNAPSHOT</currentVersion>
<description/>
<shortDescription>Produce Checkstyle report</shortDescription>
<url>http://maven.apache.org/reference/plugins/checkstyle/</url>
@@ -65,6 +65,11 @@
<name>2.4.1</name>
<tag>MAVEN_CHECKSTYLE_2_4_1</tag>
</version>
<version>
<id>2.5</id>
<name>2.5</name>
<tag>HEAD</tag>
</version>
</versions>
<developers>
<developer>

View File

@@ -46,7 +46,8 @@
<section name="Checkstyle Results">
<p>
The following document contains the results of
<a href="http://checkstyle.sourceforge.net/">Checkstyle</a>.
<a href="http://checkstyle.sourceforge.net/">Checkstyle</a>
<a href="checkstyle.rss"><img src="images/rss.png"/></a>.
</p>
</section>

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
-->
<jsl:stylesheet
select="$doc"
xmlns:j="jelly:core"
xmlns:jsl="jelly:jsl"
xmlns:util="jelly:util"
xmlns:x="jelly:xml"
xmlns:doc="doc"
xmlns="dummy" trim="true">
<!-- This needs to be instantiated here to be available in the template matches -->
<j:useBean var="mavenTool" class="org.apache.maven.util.MavenTool"/>
<j:useBean var="htmlescape" class="org.apache.velocity.anakia.Escape"/>
<j:useBean var="fileutil" class="org.apache.velocity.texen.util.FileUtil"/>
<j:useBean var="pathtool" class="org.apache.maven.util.DVSLPathTool"/>
<jsl:template match="checkstyle">
<rss version="0.91">
<channel>
<title>Checkstyle report</title>
<link>${pom.url}</link>
<description>Checkstyle report</description>
<language>en-us</language>
<copyright>Copyright 2004 The Apache Software Foundation</copyright>
<item>
<j:set var="fileCount"><x:expr select="count(file)"/></j:set>
<j:set var="infoCount"><x:expr select="count(file/error[@severity='info'])"/></j:set>
<j:set var="warningCount"><x:expr select="count(file/error[@severity='warning'])"/></j:set>
<j:set var="errorCount"><x:expr select="count(file/error[@severity='error'])"/></j:set>
<title>File: ${fileCount}, Errors: ${errorCount}, Warnings: ${warningCount}, Infos: ${infoCount}</title>
<!-- If we don't go through a tmp variable Jelly inserts a space between ${pom.url}
and '/checkstyle-report.html'. Go figure... -->
<j:set var="link" value="${pom.url}/checkstyle-report.html"/>
<link>${link}</link>
<description>
<p>Click <a href="${pom.url}/checkstyle-report.html">here</a> for the full Checkstyle report.</p>
<table summary="Files" border="1">
<thead>
<tr>
<th>Files</th>
<th style="width:30px">I</th>
<th style="width:30px">W</th>
<th style="width:30px">E</th>
</tr>
</thead>
<tbody>
<j:set var="fullSrcDir" value="${pom.build.sourceDirectory}"/>
<j:set var="srcDir" value="${fileutil.file(fullSrcDir).getCanonicalPath()}"/>
<j:set var="srcDirLength" value="${srcDir.length() + 1}"/>
<x:set var="files" select="file" sort="@name"/>
<!-- x:forEach is busted -->
<j:forEach var="file" items="${files}">
<!-- Type coercion doesn't work worth a fuck in jexl. -->
<j:set var="name" value="${file.attribute('name').getValue()}"/>
<j:set var="name" value="${name.substring(mavenTool.toInteger(srcDirLength.toString()))}"/>
<util:replace var="name" value="${name}" oldChar="\\" newChar="/"/>
<!--- +1 is for the trailing slash above -->
<j:set var="infoCount"><x:expr select="count($file/error[@severity='info'])"/></j:set>
<j:set var="warningCount"><x:expr select="count($file/error[@severity='warning'])"/></j:set>
<j:set var="errorCount"><x:expr select="count($file/error[@severity='error'])"/></j:set>
<j:if test="${errorCount + warningCount + infoCount != 0}">
<tr>
<td>
<a href="${link}#${name}">${name}</a>
</td>
<td><doc:formatAsNumber string="${infoCount}" pattern="0"/></td>
<td><doc:formatAsNumber string="${warningCount}" pattern="0"/></td>
<td><doc:formatAsNumber string="${errorCount}" pattern="0"/></td>
</tr>
</j:if>
</j:forEach>
</tbody>
</table>
</description>
</item>
</channel>
</rss>
</jsl:template>
</jsl:stylesheet>

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

View File

@@ -25,7 +25,10 @@
<author email="evenisse@ifrance.com">Emmanuel Venisse</author>
</properties>
<body>
<release version="2.4.2-SNAPSHOT" date="In CVS">
<release version="2.5-SNAPSHOT" date="In CVS">
<action dev="vmassol" type="add">
Added generation of a Checkstyle RSS feed.
</action>
<action dev="aheritier" type="fix" issue="MPCHECKSTYLE-21">Fix : Build failed if target directory and License file didn't exist.</action>
</release>
<release version="2.4.1" date="2004-05-18">