Author: carlos Date: Wed Jun 8 21:59:16 2005 New Revision: 189706 URL: http://svn.apache.org/viewcvs?rev=189706&view=rev Log: Generate reports filtered by severity
Added: maven/maven-1/plugins/trunk/checkstyle/src/plugin-resources/checkstyle_severity_filter.jsl Modified: maven/maven-1/plugins/trunk/checkstyle/plugin.jelly maven/maven-1/plugins/trunk/checkstyle/src/plugin-resources/checkstyle.jsl maven/maven-1/plugins/trunk/checkstyle/xdocs/changes.xml Modified: maven/maven-1/plugins/trunk/checkstyle/plugin.jelly URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/checkstyle/plugin.jelly?rev=189706&r1=189705&r2=189706&view=diff ============================================================================== --- maven/maven-1/plugins/trunk/checkstyle/plugin.jelly (original) +++ maven/maven-1/plugins/trunk/checkstyle/plugin.jelly Wed Jun 8 21:59:16 2005 @@ -27,7 +27,9 @@ xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:util="jelly:util" - xmlns:doc="doc"> + xmlns:doc="doc" + xmlns:define="jelly:define" + xmlns:checkstyle="checkstyle"> <!-- ======================================================================== @@ -194,6 +196,11 @@ outputMode="xml" prettyPrint="true"/> + <!-- Generate filtered pages for each severity level --> + <checkstyle:report-filtered severity="error"/> + <checkstyle:report-filtered severity="warning"/> + <checkstyle:report-filtered severity="info"/> + <!-- Generate a RSS feed of the checktyle errors --> <doc:jsl input="${maven.build.dir}/checkstyle-raw-report.xml" @@ -234,5 +241,26 @@ <doc:deregisterReport name="Checkstyle"/> </j:if> </goal> + + + <!-- Generate a report filtering errors by severity --> + + <define:taglib uri="checkstyle"> + + <define:tag name="report-filtered"> + <!-- @severity: severity for which to generate the report --> + + <echo>Generating report for severity ${severity}...</echo> + + <doc:jsl + input="${maven.build.dir}/checkstyle-raw-report.xml" + output="checkstyle-report-${severity}.xml" + stylesheet="${plugin.resources}/checkstyle_severity_filter.jsl" + encoding="${maven.docs.outputencoding}" + outputMode="xml" + prettyPrint="true"/> + </define:tag> + + </define:taglib> </project> Modified: maven/maven-1/plugins/trunk/checkstyle/src/plugin-resources/checkstyle.jsl URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/checkstyle/src/plugin-resources/checkstyle.jsl?rev=189706&r1=189705&r2=189706&view=diff ============================================================================== --- maven/maven-1/plugins/trunk/checkstyle/src/plugin-resources/checkstyle.jsl (original) +++ maven/maven-1/plugins/trunk/checkstyle/src/plugin-resources/checkstyle.jsl Wed Jun 8 21:59:16 2005 @@ -51,6 +51,16 @@ </p> </section> + <section name="Errors filtered by severity"> + <p> + <ul> + <li><a href="checkstyle-report-error.html">Error</a></li> + <li><a href="checkstyle-report-warning.html">Warning</a></li> + <li><a href="checkstyle-report-info.html">Info</a></li> + </ul> + </p> + </section> + <section name="Summary"> <j:set var="fileCount"><x:expr select="count(file)"/></j:set> <j:set var="infoCount"><x:expr select="count(file/[EMAIL PROTECTED]'info'])"/></j:set> Added: maven/maven-1/plugins/trunk/checkstyle/src/plugin-resources/checkstyle_severity_filter.jsl URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/checkstyle/src/plugin-resources/checkstyle_severity_filter.jsl?rev=189706&view=auto ============================================================================== --- maven/maven-1/plugins/trunk/checkstyle/src/plugin-resources/checkstyle_severity_filter.jsl (added) +++ maven/maven-1/plugins/trunk/checkstyle/src/plugin-resources/checkstyle_severity_filter.jsl Wed Jun 8 21:59:16 2005 @@ -0,0 +1,177 @@ +<?xml version="1.0"?> + +<!-- + * ======================================================================== + * + * 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"> + <document> + + <properties> + <title>Checkstyle errors in severity ${severity}</title> + </properties> + + + <!-- TODO find a better way to do this --> + <j:choose> + <j:when test="${severity.equalsIgnoreCase('error')}"> + <x:set var="severity" select="'error'"/> + </j:when> + <j:when test="${severity.equalsIgnoreCase('warning')}"> + <x:set var="severity" select="'warning'"/> + </j:when> + <j:when test="${severity.equalsIgnoreCase('info')}"> + <x:set var="severity" select="'info'"/> + </j:when> + <j:otherwise> + </j:otherwise> + </j:choose> + + + <body> + <section name="Checkstyle Errors"> + <p> + The following document contains the results of + <a href="http://checkstyle.sourceforge.net/">Checkstyle</a> + <a href="checkstyle.rss"><img src="images/rss.png"/></a> + for severity ${severity}. + </p> + </section> + + <section name="Summary"> + <j:set var="fileCount"><x:expr select="count(file)"/></j:set> + <j:set var="errorCount"><x:expr select="count(file/[EMAIL PROTECTED])"/></j:set> + <table summary="Report summary"> + <thead> + <tr> + <th>Files</th> + <th style="width:75px">Errors</th> + </tr> + </thead> + <tbody> + <tr> + <td><doc:formatAsNumber string="${fileCount}" pattern="0"/></td> + <td><doc:formatAsNumber string="${errorCount}" pattern="0"/></td> + </tr> + </tbody> + </table> + </section> + + <section name="Files"> + <table summary="Files"> + <thead> + <tr> + <th>Files</th> + <th style="width:30px">Errors</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[./[EMAIL PROTECTED]" 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="errorCount"><x:expr select="count($file/[EMAIL PROTECTED])"/></j:set> + + <j:if test="${errorCount != 0}"> + <tr> + <td> + <a href="#${name}">${name}</a> + </td> + <td><doc:formatAsNumber string="${errorCount}" pattern="0"/></td> + </tr> + </j:if> + </j:forEach> + </tbody> + </table> + + <j:forEach var="file" items="${files}"> + <x:set var="errorCount" select="count($file/[EMAIL PROTECTED])"/> + <j:if test="${errorCount != 0}"> + <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="/"/> + + <subsection name="${name}"> + <table summary="Error details for ${name}"> + <thead> + <tr> + <th colspan="2">Error</th> + <th style="width:20px">Line</th> + </tr> + </thead> + <x:set var="errors" select="$file/[EMAIL PROTECTED]"/> + <j:forEach var="error" items="${errors}"> + <tbody> + <tr> + <td style="width:20px"> + <img src="images/icon_${severity}_sml.gif" width="15" height="15" alt="Error" /> + </td> + <td> + <j:set var="errorMessage" value="${error.attribute('message').getValue()}"/> + ${htmlescape.getText(errorMessage)} + </td> + <td> + <j:set var="line" value="${error.attribute('line').getValue()}"/> + <j:set var="lastIndex" value="${name.lastIndexOf('.java')}"/> + <j:choose> + <j:when test="${lastIndex > 0}"> + <j:set var="index" value="${mavenTool.toInteger(lastIndex.toString())}"/> + <j:set var="nameWithoutJavaExtension" value="${name.substring(0, index)}"/> + <util:replace var="nameWithoutJavaExtension" value="${nameWithoutJavaExtension}" oldChar="\\" newChar="/"/> + <a href="xref/${nameWithoutJavaExtension}.html#${line}">${line}</a> + </j:when> + <j:otherwise> + ${line} + </j:otherwise> + </j:choose> + </td> + </tr> + </tbody> + </j:forEach> + </table> + </subsection> + </j:if> + </j:forEach> + </section> + </body> + </document> + </jsl:template> +</jsl:stylesheet> Modified: maven/maven-1/plugins/trunk/checkstyle/xdocs/changes.xml URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/checkstyle/xdocs/changes.xml?rev=189706&r1=189705&r2=189706&view=diff ============================================================================== --- maven/maven-1/plugins/trunk/checkstyle/xdocs/changes.xml (original) +++ maven/maven-1/plugins/trunk/checkstyle/xdocs/changes.xml Wed Jun 8 21:59:16 2005 @@ -26,6 +26,7 @@ </properties> <body> <release version="3.0-SNAPSHOT" date="in SVN"> + <action dev="carlos" type="add">Generate reports filtered by severity</action> <action dev="carlos" type="update">Support for Java5</action> <action dev="carlos" type="update">Upgraded to checkstyle 4.0</action> <action dev="carlos" type="fix" issue="MPCHECKSTYLE-29">Fixed MemberName rule in Turbine checkstyle rules</action> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]