You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

maudit.html 5.5 KiB

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