bwalding    2003/08/29 17:48:31

  Added:       src/plugins-build/findbugs/src/plugin-resources findbugs.jsl
  Log:
  Sort of prints something useful now
  
  Revision  Changes    Path
  1.1                  
maven/src/plugins-build/findbugs/src/plugin-resources/findbugs.jsl
  
  Index: findbugs.jsl
  ===================================================================
  <?xml version="1.0"?>
  
  <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="false">
  
    <!-- 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="BugCollection">
      <document>
  
        <properties>
          <title>FindBugs Results</title>
        </properties>
  
        <body>
          <section name="FindBugs Results">
            <p>
              The following document contains the results of
              <a href="http://www.cs.umd.edu/~pugh/java/bugs/";>FindBugs</a>.
            </p>
          </section>
  
          <section name="Summary">
            <j:set var="classCount"><x:expr select="count(//AppClass)"/></j:set>
            <j:set var="errorCount"><x:expr select="count(//BugInstance)"/></j:set>
            <table>
              <tr>
                <th>Classes / Interfaces</th>
                <th width="15%">Bugs</th>
              </tr>
              <tr>
                <td><doc:formatAsNumber string="${classCount}" pattern="0"/></td>
                <td><doc:formatAsNumber string="${errorCount}" pattern="0"/></td>
              </tr>
            </table>
          </section>
  
          <section name="Classes">
            <table>
                <tr>
                <th>Class</th>
                <th width="15%">Bugs</th>
              </tr>
              
              <!-- Just get distinct classnames -->
              <x:set var="bugs" 
                     select="//BugInstance[not(Class/@classname = 
preceding-sibling::BugInstance/Class/@classname)]"/>
              <j:forEach var="bug" items="${bugs}">
                <j:set var="classname"><x:expr select="$bug/Class/@classname"/></j:set>
                <j:set var="errorCount"><x:expr 
select="count(//BugInstance[Class/@classname = '${classname}'])"/></j:set>
                
                <tr>
                  <td>
                    <a href="#${classname}">${classname}</a>
                  </td>
                  <td><doc:formatAsNumber string="${errorCount}" pattern="0"/></td>
                </tr>          
              </j:forEach>
            </table>
          </section>
            
            <section name="Bugs">
              <x:set var="bugs" 
                     select="//BugInstance[not(Class/@classname = 
preceding-sibling::BugInstance/Class/@classname)]"/>
              <j:forEach var="bug" items="${bugs}">
                <j:set var="classname"><x:expr select="$bug/Class/@classname"/></j:set>
                <x:set var="bugsInner" select="//BugInstance[Class/@classname = 
'${classname}']"/>
                <subsection name="${classname}">
                  <j:forEach var="bugInner" items="${bugsInner}">
                    <j:set var="bugType"><x:expr select="$bugInner/@type"/></j:set>
                    <j:set var="bugTypeDescription" value="The FindBugs plugin does 
not have a message for this bug type"/>
                    
                    <j:if test="${bugType == 'DM_BOOLEAN_CTOR'}"><j:set 
var="bugTypeDescription">Dubious use of the Boolean constructor. Use 
valueOf.</j:set></j:if>
                    
                    <table width="100%">
                      <tr>
                        <th width="15%">Bug Type</th><td>${bugType}</td>
                      </tr>
                      <tr>
                        <th width="15%">Bug 
Description</th><td>${bugTypeDescription}</td>
                      </tr>
                      <tr>
                        <th>Method</th><td><x:expr 
select="$bugInner/Method/@name"/></td>
                      </tr>
                      <tr>
                        <th>Field</th><td><x:expr select="$bugInner/Field/@name"/></td>
                      </tr>
                    </table>
                  </j:forEach>
                </subsection>
              </j:forEach>
            </section>
          
        </body>
      </document>
    </jsl:template>
  </jsl:stylesheet>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to