| <html> |
| |
| <head> |
| <meta http-equiv="Content-Language" content="en-us"> |
| <title>MAudit Task</title> |
| </head> |
| |
| <body> |
| |
| <h2><a name="maudit">MAudit</a></h2> |
| <ul> |
| <li>Stephane Bailliez (<a href="mailto:sbailliez@imediation.com">sbailliez@imediation.com</a>)</li> |
| </ul> |
| <h3>Requirements</h3> |
| <p>This task requires Metamata Development environment 2.0/Webgain Quality Analyzer 2.0. |
| An evaluation version is available at <a href="http://www.webgain.com/products/quality_analyzer/">Webgain</a>. |
| , <a href="http://jakarta.apache.org/oro/">Jakarta Oro</a> and a XML parser (via JAXP).</p> |
| <h3>Description</h3> |
| <p> |
| Invokes the Metamata Audit/ Webgain Quality Analyzer on a set of Java files. |
| </p> |
| <p> |
| <i>maudit</i> performs static analysis of the Java source code and byte code files to find and report |
| errors of style and potential problems related to performance, maintenance and robustness. |
| . As a convenience, a stylesheet is given in <tt>etc</tt> directory, so that an HTML report can be generated from the XML file. |
| </p> |
| |
| <h3>Parameters</h3> |
| <table border="1" cellpadding="2" cellspacing="0"> |
| <tr> |
| <td valign="top"><b>Attribute</b></td> |
| <td valign="top"><b>Description</b></td> |
| <td align="center" valign="top"><b>Required</b></td> |
| </tr> |
| <tr> |
| <td valign="top">tofile</td> |
| <td valign="top">The XML file to which the Audit result should be written to.</td> |
| <td valign="top" align="center">Yes</td> |
| </tr> |
| <tr> |
| <td valign="top">metamatahome</td> |
| <td valign="top">The home directory containing the Metamata distribution.</td> |
| <td valign="top" align="center">Yes</td> |
| </tr> |
| <tr> |
| <td valign="top">fix</td> |
| <td valign="top"> |
| Automatically fix certain errors (those marked as fixable in the manual). |
| </td> |
| <td valign="top" align="center">No.Default to false.</td> |
| </tr> |
| <tr> |
| <td valign="top">list</td> |
| <td valign="top"> |
| Creates listing file for each audited file. A .maudit file will be generated in the |
| same location as the source file. |
| </td> |
| <td valign="top" align="center">No. Default to false.</td> |
| </tr> |
| <tr> |
| <td valign="top">unused</td> |
| <td valign="top"> |
| Finds declarations unused in search paths. It will look for unused global declarations |
| in the source code within a use domain specified by the <tt>searchpath</tt> element. |
| </td> |
| <td valign="top" align="center">No. Default to false.</td> |
| </tr> |
| <tr> |
| <td valign="top">maxmemory</td> |
| <td valign="top">Set the maximum memory for the JVM. this is a convenient |
| way to set the -mx or -Xmx argument.</td> |
| <td valign="top" align="center">No</td> |
| </tr> |
| </table> |
| <h3>Nested elements</h3> |
| <h4>jvmarg</h4> |
| <p>Additional parameters may be passed to the VM via nested <code><jvmarg></code> |
| attributes. <code><jvmarg></code> allows all attributes described in <a href="../using.html#arg">Command |
| line arguments</a>.</p> |
| <h4>classpath</h4> |
| <p>Sets class path (also source path unless one explicitly set). Overrides |
| METAPATH/CLASSPATH environment variables. The <tt>classpath</tt> element represents a <a href="../using.html#path">PATH like |
| structure</a>.</p> |
| <h4>sourcepath</h4> |
| <p>Sets source path. Overrides the SOURCEPATH environment variable. The <tt>sourcepath</tt> element represents a <a href="../using.html#path">PATH like |
| structure</a>.</p> |
| <h4>sourcepath</h4> |
| <p>Sets the search path to use as the use domain when looking for unused global declarations. The <tt>searchpath</tt> element represents a <a href="../using.html#path">PATH like |
| structure</a>.</p> |
| <h4>fileset</h4> |
| <p>Sets the Java files to audit via a <a href="../CoreTypes/fileset.html">FILESET</a> structure. |
| Whatever the filter is, only the files that ends with <i>.java</i> will be included for processing. |
| Note that the base directory used for the fileset MUST be the root of the source files otherwise |
| package names deduced from the file path will be incorrect. |
| </p> |
| <h3>Example</h3> |
| <pre> <maudit tofile="c:/metamata/examples/auditexamples/audit.xml" |
| metamatahome="c:/metamata" fix="yes"> |
| <classpath> |
| <pathelement location="c:/metamata/examples/auditexamples"/> |
| </classpath> |
| <sourcepath> |
| <pathelement location="c:/metamata/examples/auditexamples"/> |
| </sourcepath> |
| <fileset dir="c:/metamata/examples/auditexamples"> |
| <include name="*.java"/> |
| <fileset> |
| </maudit></pre> |
| <p> |
| This invokes Metamata Audit installed in <tt>c:/metamata</tt> on the audit examples |
| and fix automatically the fixable errors. |
| </p> |
| <h3>Generating a report</h3> |
| As a convenience, there is an XSL file(mmetrics-frames.xsl) that allows you to generate a full framed HTML report of the metrics. |
| You can find it in the <i>etc</i> directory of Ant. As it uses the Xalan redirect extensions, you will need Xalan and Xerces to run it. |
| The stylesheet takes an <i>output.dir</i> parameter (otherwise it will be generated |
| in the current directory), it can be run in Ant as follows: |
| <pre> |
| <style in=java "${audit.xml}" style="maudit-frames.xsl" out="null.tmp"> |
| <param name="output.dir" expression="${report.dir}quot;/> |
| </style> |
| </pre> |
| |
| <hr> |
| <p align="center">Copyright © 2001-2002 Apache Software Foundation. All rights |
| Reserved.</p> |
| </body> |
| </html> |