jvanzyl     2002/06/27 22:45:51

  Added:       src/plugins/checkstyle checkstyle.dvsl
  Log:
  Need the checkstyle dvsl. Decoupling is fun!
  
  Revision  Changes    Path
  1.1                  jakarta-turbine-maven/src/plugins/checkstyle/checkstyle.dvsl
  
  Index: checkstyle.dvsl
  ===================================================================
  #######################################################################
  ## C H E C K S T Y L E     D V S L    S T Y L E S H E E T            ##
  #######################################################################
  
  ## This stylesheet is used to transform the output of Checkstyle's xml
  ## generator.  The XML is transformed into a standard xdoc that can
  ## then be transformed (yet again) using whatever stylesheet is used
  ## to format one's site.
  ##
  ## Based on the XSL stylesheet checkstyle-noframes.xsl from the
  ## checkstyle contrib.
  ##
  ## Version: $Id: checkstyle.dvsl,v 1.1 2002/06/28 05:45:51 jvanzyl Exp $
  
  #######################################################################
  ## V E L O C I T Y    M A C R O S                                    ##
  #######################################################################
  
  ## Convert a string that represents a number using the specified
  ## pattern.
  ##
  #macro (formatAsNumber $string $pattern)
      #set ($value = $context.toolbox.numbers.parse($string))
      $context.toolbox.formatter.formatNumber($value, $pattern)
  #end
  
  ## Create link to the xref docs for a particular file and line
  ## number.
  ##
  #macro (createLineNumberLink $name $line)
      #set ($lastIndex = $name.lastIndexOf(".java"))
      #if ($lastIndex > 0)
        #set ($nameWithoutJavaExtension = $name.substring(0, $lastIndex))
        <a href="xref/${nameWithoutJavaExtension}.html#$line">$line</a>
      #else
        $line
      #end
  #end
  
  #######################################################################
  ## T E M P L A T E    D E F I N I T I O N S                          ##
  #######################################################################
  
  ## Matches the root element of the JUnit XML report.
  ##
  #match ("checkstyle")
  <?xml version="1.0"?>
  
  <document>
  
    <properties>
      <title>Checkstyle Results</title>
    </properties>
  
    <body>
      <section name="Checkstyle Results">
        <p>
          The following document contains the results of <a
          href="http://checkstyle.sourceforge.net/";>Checkstyle</a>.
        </p>
      </section>
  
      ###################################################################
      <section name="Summary">
        #set ($fileCount  = $node.valueOf("count(file)"))
        #set ($errorCount = $node.valueOf("count(file/error)"))
        <table>
          <tr><th>Files</th><th>Errors</th></tr>
          <tr><td>$fileCount</td><td>$errorCount</td></tr>
        </table>
      </section>
  
      ###################################################################
      <section name="Files">
        <table>
          <tr><th>Files</th><th>Errors</th></tr>
          #foreach ($file in $node.selectNodes("file"))
            #set ($name = 
$context.toolbox.pathtool.getPackagePath($file.attribute('name')))
            #set ($errorCount = $file.valueOf("count(error)"))
            #if ($errorCount != "0")
          <tr>
            <td><a href="#$name">$name</a></td>
            <td>$errorCount</td>
          </tr>
            #end
          #end
        </table>
  
        #foreach ($file in $node.selectNodes("file"))
          #if ($file.get("error"))
            #set ($name = 
$context.toolbox.pathtool.getPackagePath($file.attribute('name')))
  
        <subsection name="$name">
          <table>
            <tr><th>Error</th><th>Line</th></tr>
            #foreach ($error in $file.selectNodes("error"))
            <tr>
              <td>$context.toolbox.htmlescape.getText($error.attribute('message'))</td>
              <td>#createLineNumberLink($name $error.attribute('line'))</td>
            </tr>
            #end
          </table>
        </subsection>
          #end
        #end
      </section>
    </body>
  </document>
  #end
  
  
  
  

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

Reply via email to