1 | <html>
|
---|
2 |
|
---|
3 | <head>
|
---|
4 | <meta http-equiv="Content-Language" content="en-us">
|
---|
5 | <title>MAudit Task</title>
|
---|
6 | <link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
|
---|
7 | </head>
|
---|
8 |
|
---|
9 | <body>
|
---|
10 |
|
---|
11 | <h2><a name="maudit">MAudit</a></h2>
|
---|
12 | <ul>
|
---|
13 | <li>Stephane Bailliez (<a href="mailto:[email protected]">[email protected]</a>)</li>
|
---|
14 | </ul>
|
---|
15 | <h3>Requirements</h3>
|
---|
16 | <p>This task requires Metamata Development environment 2.0/Webgain Quality Analyzer 2.0.
|
---|
17 | An evaluation version is available at <a href="http://www.webgain.com/products/quality_analyzer/">Webgain</a>.
|
---|
18 | , <a href="http://jakarta.apache.org/oro/">Jakarta Oro</a> and a XML parser (via JAXP).</p>
|
---|
19 | <h3>Description</h3>
|
---|
20 | <p>
|
---|
21 | Invokes the Metamata Audit/ Webgain Quality Analyzer on a set of Java files.
|
---|
22 | </p>
|
---|
23 | <p>
|
---|
24 | <i>maudit</i> performs static analysis of the Java source code and byte code files to find and report
|
---|
25 | errors of style and potential problems related to performance, maintenance and robustness.
|
---|
26 | . As a convenience, a stylesheet is given in <tt>etc</tt> directory, so that an HTML report can be generated from the XML file.
|
---|
27 | </p>
|
---|
28 |
|
---|
29 | <h3>Parameters</h3>
|
---|
30 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
31 | <tr>
|
---|
32 | <td valign="top"><b>Attribute</b></td>
|
---|
33 | <td valign="top"><b>Description</b></td>
|
---|
34 | <td align="center" valign="top"><b>Required</b></td>
|
---|
35 | </tr>
|
---|
36 | <tr>
|
---|
37 | <td valign="top">tofile</td>
|
---|
38 | <td valign="top">The XML file to which the Audit result should be written to.</td>
|
---|
39 | <td valign="top" align="center">Yes</td>
|
---|
40 | </tr>
|
---|
41 | <tr>
|
---|
42 | <td valign="top">metamatahome</td>
|
---|
43 | <td valign="top">The home directory containing the Metamata distribution.</td>
|
---|
44 | <td valign="top" align="center">Yes</td>
|
---|
45 | </tr>
|
---|
46 | <tr>
|
---|
47 | <td valign="top">fix</td>
|
---|
48 | <td valign="top">
|
---|
49 | Automatically fix certain errors (those marked as fixable in the manual).
|
---|
50 | </td>
|
---|
51 | <td valign="top" align="center">No.Default to false.</td>
|
---|
52 | </tr>
|
---|
53 | <tr>
|
---|
54 | <td valign="top">list</td>
|
---|
55 | <td valign="top">
|
---|
56 | Creates listing file for each audited file. A .maudit file will be generated in the
|
---|
57 | same location as the source file.
|
---|
58 | </td>
|
---|
59 | <td valign="top" align="center">No. Default to false.</td>
|
---|
60 | </tr>
|
---|
61 | <tr>
|
---|
62 | <td valign="top">unused</td>
|
---|
63 | <td valign="top">
|
---|
64 | Finds declarations unused in search paths. It will look for unused global declarations
|
---|
65 | in the source code within a use domain specified by the <tt>searchpath</tt> element.
|
---|
66 | </td>
|
---|
67 | <td valign="top" align="center">No. Default to false.</td>
|
---|
68 | </tr>
|
---|
69 | <tr>
|
---|
70 | <td valign="top">maxmemory</td>
|
---|
71 | <td valign="top">Set the maximum memory for the JVM. this is a convenient
|
---|
72 | way to set the -mx or -Xmx argument.</td>
|
---|
73 | <td valign="top" align="center">No</td>
|
---|
74 | </tr>
|
---|
75 | </table>
|
---|
76 | <h3>Nested elements</h3>
|
---|
77 | <h4>jvmarg</h4>
|
---|
78 | <p>Additional parameters may be passed to the VM via nested <code><jvmarg></code>
|
---|
79 | attributes. <code><jvmarg></code> allows all attributes described in
|
---|
80 | <a href="../using.html#arg">Command line arguments</a>.</p>
|
---|
81 | <p>
|
---|
82 | You can avoid using the <code><jvmarg></code> by adding these empty
|
---|
83 | entries to <code>metamata.properties</code> located at <code>${metamata.home}/bin</code>
|
---|
84 | </p>
|
---|
85 | <pre>metamata.classpath=
|
---|
86 | metamata.sourcepath=
|
---|
87 | metamata.baseclasspath=
|
---|
88 | </pre>
|
---|
89 | </p>
|
---|
90 | <h4>classpath</h4>
|
---|
91 | <p>Sets class path (also source path unless one explicitly set). Overrides
|
---|
92 | METAPATH/CLASSPATH environment variables. The <tt>classpath</tt> element represents a <a href="../using.html#path">PATH like
|
---|
93 | structure</a>.</p>
|
---|
94 | <h4>sourcepath</h4>
|
---|
95 | <p>Sets source path. Overrides the SOURCEPATH environment variable. The <tt>sourcepath</tt> element represents a <a href="../using.html#path">PATH like
|
---|
96 | structure</a>.</p>
|
---|
97 | <h4>sourcepath</h4>
|
---|
98 | <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
|
---|
99 | structure</a>.</p>
|
---|
100 | <h4>fileset</h4>
|
---|
101 | <p>Sets the Java files to audit via a <a href="../CoreTypes/fileset.html">FILESET</a> structure.
|
---|
102 | Whatever the filter is, only the files that ends with <i>.java</i> will be included for processing.
|
---|
103 | Note that the base directory used for the fileset MUST be the root of the source files otherwise
|
---|
104 | package names deduced from the file path will be incorrect.
|
---|
105 | </p>
|
---|
106 | <h3>Example</h3>
|
---|
107 | <pre> <maudit tofile="c:/metamata/examples/auditexamples/audit.xml"
|
---|
108 | metamatahome="c:/metamata" fix="yes">
|
---|
109 | <classpath>
|
---|
110 | <pathelement location="c:/metamata/examples/auditexamples"/>
|
---|
111 | </classpath>
|
---|
112 | <sourcepath>
|
---|
113 | <pathelement location="c:/metamata/examples/auditexamples"/>
|
---|
114 | </sourcepath>
|
---|
115 | <fileset dir="c:/metamata/examples/auditexamples">
|
---|
116 | <include name="*.java"/>
|
---|
117 | </fileset>
|
---|
118 | </maudit></pre>
|
---|
119 | <p>
|
---|
120 | This invokes Metamata Audit installed in <tt>c:/metamata</tt> on the audit examples
|
---|
121 | and fix automatically the fixable errors.
|
---|
122 | </p>
|
---|
123 | <h3>Generating a report</h3>
|
---|
124 | As a convenience, there is an XSL file(mmetrics-frames.xsl) that allows you to generate a full framed HTML report of the metrics.
|
---|
125 | 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.
|
---|
126 | The stylesheet takes an <i>output.dir</i> parameter (otherwise it will be generated
|
---|
127 | in the current directory), it can be run in Ant as follows:
|
---|
128 | <pre>
|
---|
129 | <style in=java "${audit.xml}" style="maudit-frames.xsl" out="null.tmp">
|
---|
130 | <param name="output.dir" expression="${report.dir}"/>
|
---|
131 | </style>
|
---|
132 | </pre>
|
---|
133 |
|
---|
134 | <hr>
|
---|
135 | <p align="center">Copyright © 2001-2002,2004 The Apache Software Foundation. All rights
|
---|
136 | Reserved.</p>
|
---|
137 | </body>
|
---|
138 | </html>
|
---|