ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata AbstractMetamataTask.java MAudit.java MMetrics.java MParse.java
Date Sun, 23 Jun 2002 06:05:31 GMT
stevel      2002/06/22 23:05:31

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/metamata
                        Tag: ANT_15_BRANCH AbstractMetamataTask.java
                        MAudit.java MMetrics.java MParse.java
  Log:
  Maudit and companions. Jesse Stockhall has refactored mparse already and mailed me the diff,
but that can probably wait until 1.6
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.7.2.1   +37 -6     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  
  Index: AbstractMetamataTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- AbstractMetamataTask.java	25 Apr 2002 12:14:50 -0000	1.7
  +++ AbstractMetamataTask.java	23 Jun 2002 06:05:31 -0000	1.7.2.1
  @@ -123,16 +123,25 @@
           cmdl.setClassname(className);
       }
   
  -    /** the metamata.home property to run all tasks. */
  +    /**
  +     * the metamata.home property to run all tasks.
  +     * @ant.attribute ignore="true"
  +     */
       public void setHome(final File value) {
           this.metamataHome = value;
       }
   
  +    /**
  +     * The home directory containing the Metamata distribution; required
  +     */
       public void setMetamatahome(final File value) {
           setHome(value);
       }
   
  -    /** user classpath */
  +    /**
  +     * Sets the class path (also source path unless one explicitly set).
  +     * Overrides METAPATH/CLASSPATH environment variables.
  +     */
       public Path createClasspath() {
           if (classPath == null) {
               classPath = new Path(project);
  @@ -140,7 +149,10 @@
           return classPath;
       }
   
  -    /** create the source path for this task */
  +    /**
  +     * Sets the source path. 
  +     * Overrides the SOURCEPATH environment variable. 
  +     */
       public Path createSourcepath() {
           if (sourcePath == null) {
               sourcePath = new Path(project);
  @@ -148,18 +160,37 @@
           return sourcePath;
       }
   
  -    /** Creates a nested jvmarg element. */
  +    /**
  +     * Additional optional parameters to pass to the JVM. 
  +     * You can avoid using the  <code>&lt;jvmarg&gt;</code> by adding
these empty 
  +     * entries to <code>metamata.properties</code> located at <code>${metamata.home}/bin</code>
  +     *
  +     * <pre>metamata.classpath=
  +     * metamata.sourcepath=
  +     * metamata.baseclasspath=
  +     * </pre>
  +     */
       public Commandline.Argument createJvmarg() {
           return cmdl.createVmArgument();
       }
   
  -    /**  -mx or -Xmx depending on VM version */
  +    /**
  +     * Set the maximum memory for the JVM; optional.
  +     * -mx or -Xmx depending on VM version 
  +     */
       public void setMaxmemory(String max) {
           cmdl.setMaxmemory(max);
       }
   
   
  -    /** The java files or directory to be audited */
  +    /** 
  +     * The java files or directory to audit.
  +     * Whatever the filter is, only the files that end 
  +     * with .java 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. 
  +     */
       public void addFileSet(FileSet fs) {
           fileSets.addElement(fs);
       }
  
  
  
  1.6.2.1   +62 -13    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java
  
  Index: MAudit.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- MAudit.java	15 Apr 2002 14:56:33 -0000	1.6
  +++ MAudit.java	23 Jun 2002 06:05:31 -0000	1.6.2.1
  @@ -67,17 +67,12 @@
   import org.apache.tools.ant.types.Path;
   
   /**
  - * Metamata Audit evaluates Java code for programming errors, weaknesses, and
  - * style violation.
  + * Invokes the Metamata Audit/ Webgain Quality Analyzer on a set of Java files.
    * <p>
  - * Metamata Audit exists in three versions:
  - * <ul>
  - *  <li>The Lite version evaluates about 15 built-in rules.</li>
  - *  <li>The Pro version evaluates about 50 built-in rules.</li>
  - *  <li>The Enterprise version allows you to add your own customized rules via the
API.</li>
  - * <ul>
  - * For more information, visit the website at
  - * <a href="http://www.metamata.com">www.metamata.com</a>
  + * <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.
    *
    * @author <a href="mailto:sbailliez@apache.org">Stephane Bailliez</a>
    */
  @@ -141,44 +136,89 @@
           super("com.metamata.gui.rc.MAudit");
       }
   
  -    /** set the destination file which should be an xml file */
  +    /** 
  +     * The XML file to which the Audit result should be written to; required
  +     */
  +     
       public void setTofile(File outFile) {
           this.outFile = outFile;
       }
   
  +    /**
  +     * Automatically fix certain errors 
  +     * (those marked as fixable in the manual);
  +     * optional, default=false
  +     */
       public void setFix(boolean flag) {
           this.fix = flag;
       }
   
  +    /**
  +     * Creates listing file for each audited file; optional, default false. 
  +     * When set, a .maudit file will be generated in the
  +     * same location as the source file.
  +     */
       public void setList(boolean flag) {
           this.list = flag;
       }
   
  +    /**
  +     * Finds declarations unused in search paths; optional, default false. 
  +     * It will look for unused global declarations
  +     * in the source code within a use domain specified by the 
  +     * <tt>searchpath</tt> element.
  +     */
       public void setUnused(boolean flag) {
           this.unused = flag;
       }
   
  +    /**
  +     * flag to suppress copyright and summary messages; default false.
  +     * internal/testing only
  +     * @ant.attribute ignore="true"
  +     */
       public void setQuiet(boolean flag) {
           this.quiet = flag;
       }
   
  +    /**
  +     * flag to tell the task to exit after the first error. 
  +     * internal/testing only
  +     * @ant.attribute ignore="true"
  +     */
       public void setExit(boolean flag) {
           this.exit = flag;
       }
   
  +    /**
  +     * internal/testing only
  +     * @ant.attribute ignore="true"
  +     */
       public void setOffsets(boolean flag) {
           this.offsets = flag;
       }
   
  +    /**
  +     * flag to print all messages; optional, default false.
  +     * internal/testing only
  +     * @ant.attribute ignore="true"
  +     */
       public void setVerbose(boolean flag) {
           this.verbose = flag;
       }
   
  +    /**
  +     * internal/testing only
  +     * @ant.attribute ignore="true"
  +     */
       public void setFullsemanticize(boolean flag) {
           this.fullsemanticize = flag;
       }
   
  -    /** one or more path for rules that must be placed before metamata.jar !! */
  +    /** 
  +     * classpath for additional audit rules
  +     * these must be placed before metamata.jar !! 
  +     */
       public Path createRulespath() {
           if (rulesPath == null) {
               rulesPath = new Path(getProject());
  @@ -186,7 +226,10 @@
           return rulesPath;
       }
   
  -    /** search path to use for unused global declarations */
  +    /** 
  +     * search path to use for unused global declarations; 
  +     * required when <tt>unused</tt> is set. 
  +     */
       public Path createSearchpath() {
           if (searchPath == null) {
               searchPath = new Path(getProject());
  @@ -194,6 +237,9 @@
           return searchPath;
       }
   
  +    /**
  +     * create the option vector for the command
  +     */
       protected Vector getOptions() {
           Vector options = new Vector(512);
           // add the source path automatically from the fileset.
  @@ -259,6 +305,9 @@
           return options;
       }
   
  +    /**
  +     * validate the settings
  +     */
       protected void checkOptions() throws BuildException {
           super.checkOptions();
           if (unused && searchPath == null) {
  
  
  
  1.5.2.1   +4 -4      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java
  
  Index: MMetrics.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- MMetrics.java	14 Feb 2002 09:30:30 -0000	1.5
  +++ MMetrics.java	23 Jun 2002 06:05:31 -0000	1.5.2.1
  @@ -67,13 +67,13 @@
   import org.apache.tools.ant.types.Path;
   
   /**
  - * Calculates global complexity and quality metrics on Java source code.
  - *
  + * Computes the metrics of a set of Java files and write the results to an XML
  + * file. 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>
    * You will not be able to use this task with the evaluation version since
    * as of Metamata 2.0, Metrics does not support command line :-(
    *
  - * For more information, visit the website at
  - * <a href="http://www.metamata.com">www.metamata.com</a>
    *
    * @author <a href="mailto:sbailliez@imediation.com">Stephane Bailliez</a>
    */
  
  
  
  1.11.2.1  +22 -9     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  
  Index: MParse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java,v
  retrieving revision 1.11
  retrieving revision 1.11.2.1
  diff -u -r1.11 -r1.11.2.1
  --- MParse.java	25 Apr 2002 12:14:50 -0000	1.11
  +++ MParse.java	23 Jun 2002 06:05:31 -0000	1.11.2.1
  @@ -79,6 +79,7 @@
    * <a href="http://www.metamata.com">http://www.metamata.com</a>
    *
    * @author <a href="mailto:sbailliez@imediation.com">Stephane Bailliez</a>
  + * @todo make a subclass of AbstractMetaMataTask
    */
   public class MParse extends Task {
   
  @@ -93,12 +94,14 @@
       private CommandlineJava cmdl = new CommandlineJava();
       private File optionsFile = null;
   
  -    /** location of metamata dev environment */
  +    /**
  +     * The home directory containing the Metamata distribution; required
  +     */
       public void setMetamatahome(File metamatahome) {
           this.metahome = metamatahome;
       }
   
  -    /** the .jj file to process */
  +    /** The .jj file to process; required. */
       public void setTarget(File target) {
           this.target = target;
       }
  @@ -119,32 +122,39 @@
           return sourcepath;
       }
   
  -    /** set verbose mode */
  +    /** set verbose mode; optional, default false */
       public void setVerbose(boolean flag){
           verbose = flag;
       }
   
  -    /** set scanner debug mode */
  +    /** set scanner debug mode; optional, default false */
       public void setDebugscanner(boolean flag){
           debugscanner = flag;
       }
   
  -    /** set parser debug mode */
  +    /** set parser debug mode; optional, default false */
       public void setDebugparser(boolean flag){
           debugparser = flag;
       }
   
  -    /** set the hack to cleanup the temp file */
  +    /** Remove the intermediate Sun JavaCC file 
  +     * ; optional, default false.
  +     */
       public void setCleanup(boolean value) {
           cleanup = value;
       }
   
  -    /** Creates a nested jvmarg element. */
  +    /**
  +     * Additional optional parameters to pass to the JVM. 
  +     */    
       public Commandline.Argument createJvmarg() {
           return cmdl.createVmArgument();
       }
   
  -    /**  -mx or -Xmx depending on VM version */
  +    /**
  +     * Set the maximum memory for the JVM; optional.
  +     * -mx or -Xmx depending on VM version 
  +     */
       public void setMaxmemory(String max){
           cmdl.setMaxmemory(max);
       }
  @@ -344,7 +354,10 @@
           }
       }
       
  -    /** create a temporary file in the current directory */
  +    /**
  +     * create a temporary file in the current directory
  +     * @todo move to using the FileUtils implementation
  +     */
       protected static final File createTmpFile(){
           // must be compatible with JDK 1.1 !!!!
           final long rand = (new Random(System.currentTimeMillis())).nextLong();
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message