flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [33/46] FlexPMD Donation from Adobe Systems Inc
Date Fri, 25 Apr 2014 06:18:32 GMT
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-core/src/test/resources/broken_pmd.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-core/src/test/resources/broken_pmd.xml b/FlexPMD/flex-pmd-core/src/test/resources/broken_pmd.xml
new file mode 100644
index 0000000..7a828ae
--- /dev/null
+++ b/FlexPMD/flex-pmd-core/src/test/resources/broken_pmd.xml
@@ -0,0 +1,703 @@
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<ruleset name="All Flex Rules" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd" xmlns="http://pmd.sf.net/ruleset/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <description/>
+  <rule since="" class="com.adobe.ac.pmd.rules.architecture.MonkeyPatchingRule" message="This class looks to be duplicated with a SDK class">
+    <description>Monkey patching can be a risky undertaking because it is not using intended extensibility points and thus may have unintended consequences or make migration to newer versions of the SDK more difficult</description>
+    <priority>1</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.mxml.MoreThanOneEntryPointInMxmlRule" message="There is more than 1 public variable in this MXML component">
+    <description/>
+    <priority>3</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.mxml.MoreThanTwoEntryPointsInMxmlRule" message="There are more than 2 public variables in this MXML component">
+    <description/>
+    <priority>1</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.mxml.TooLongScriptBlockRule" message="This script block is too long ({0} maximum, but {1} actually)">
+    <description/>
+    <priority>3</priority>
+    <properties>
+      <property name="maximum">
+        <value>50</value>
+      </property>
+    </properties>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.mxml.CodeBehindInMxmlRule" message="Avoid using code behind files">
+    <description>Code behind files are tightly coupled with the view, not unit-testable, not easy to navigate the code base and not reusable. Try using presentation model pattern, or observer pattern</description>
+    <priority>5</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.binding.BindingUtilsRule" message="BindingUtils class uses hard coded strings, which won't be picked up by the compiler if you rename this attribute. You should probably consider refactoring using events">
+    <description/>
+    <priority>1</priority>
+    <example><![CDATA[public class Controller extends FrontController
+{
+   public function Controller()
+   {
+   	 BindingUtils.bindSetter(setContent, value, "content"); // VIOLATION
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.binding.ChangeWatcherRule" message="ChangeWatcher class uses hard coded strings to specify the attribute name, to listen to. Prefer listening to events or setters">
+    <description/>
+    <priority>1</priority>
+    <example><![CDATA[public final class Title 
+{
+	private var watcher : ChangeWatcher; // VIOLATION
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.binding.TooLongBindingExpressionRule" message="This binding expression is too long ({0} dots maximum, but {1} actually)">
+    <description>A Binding expression is executed as soon as one of the bindable attributes changed. If a binding expression contains too many expression, there could be some performance issue.</description>
+    <priority>3</priority>
+    <properties>
+      <property name="maximum">
+        <value>3</value>
+      </property>
+    </properties>
+    <example><![CDATA[
+<mx:Label text="{ vfrfr.frfr.frf.lala }"/> <!-- Violation-->
+		]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.component.UpdateChildrenNumberInUpdateDisplayListRule" message="Flex specific - Do not add or remove displayable children from updateDisplayList">
+    <description>UpdateDisplayList is called everytime a child is invalidated. So calling addChild or removeChild in this function could be really CPU consuming</description>
+    <priority>1</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.component.CallLaterDirectlyRule" message="Flex specific - Don't call 'callLater' explicitly">
+    <description>If you needed to call 'callLater' explicitly, then you probably did not extend the correct component life cycle.</description>
+    <priority>1</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.css.StyleBlockInMxmlRule" message="The style block is embed in the MXML file">
+    <description>It is not a good practice to embed style blocks inside the MXML component. Prefer using external CSS files.</description>
+    <priority>3</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.css.UseCssInsteadOfEmbedMetaDataRule" message="Embed metadata detected in source code where a stylesheet may be cleaner">
+    <description/>
+    <priority>5</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.empty.EmptyCatchStatementRule" message="This catch statement is empty">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[public class Foo 
+{
+   public function bar( x : int ) : void
+   {
+      try
+      {
+      }
+      catch( e : Exception )         // VIOLATION
+      {
+      }
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.empty.EmptyIfStmtRule" message="No statements in this if statement">
+    <description>Empty If Statement finds instances where a condition is checked but nothing is done about it.</description>
+    <priority>3</priority>
+    <example><![CDATA[public class Foo 
+{
+   public function bar( x : int ) : void
+   {
+      if ( x == 0 ) 
+      {
+         // VIOLATION
+      }
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.event.EventMissingCloneFunctionRule" message="The clone event must be overiden in a custom event">
+    <description>When creating your own custom Event class, you must override the inherited Event.clone() method in order for it to duplicate the properties of your custom class. If you do not set all the properties that you add in your event subclass, those properties will not have the correct values when the event is cloned. This is important because the Flex SDK clones events whenever redispatching takes place.</description>
+    <priority>1</priority>
+    <example><![CDATA[public class FirstCustomEvent   // VIOLATION - clone method is missing
+{
+   public var lala : String;
+   
+   public function FirstCustomEvent()
+   {         
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.event.PublicVariableInCustomEventRule" message="No public variables should be inside a custom event. This variable ({0}) is public">
+    <description>In order to improve encapsulation in your custom event, it is better not to have public variable in your event. Prefer having read-only attributes, set by the event constructor.</description>
+    <priority>3</priority>
+    <example><![CDATA[public class FirstCustomEvent   
{
   public var lala : String; // VIOLATION
   
   public function FirstCustomEvent( dfsfd)
   {         
   }
}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.event.ConstructorDispatchingEventRule" message="An event is dispatched in a constructor">
+    <description>This is pointless, since event listeners cannot be attached to an object before it has been constructed, so nothing can ever hear the event</description>
+    <priority>1</priority>
+    <example><![CDATA[public class BigModel   
+{
+   public function BigModel()
+   {    
+      dispatchEvent( new Event( "pointlessEvent" ) );     
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.event.ListenForHardCodedEventNameRule" message="addEventListener must not contain hard coded strings">
+    <description>You should not listen for a plain string. If you rename this string, you need to replace the string listener as well. Use constants instead</description>
+    <priority>1</priority>
+    <example><![CDATA[public class Foo 
+{
+   public function bar() : void
+   {
+      addEventListener( "myHardCodedEvent", handleMyHardCodedEvent ); // VIOLATION
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.event.UnboundTypeInMetadataRule" message="This type ({0}) was not found within the scope against which PMD was run">
+    <description/>
+    <priority>1</priority>
+    <example><![CDATA[[Event(name="myTypeEvent",type="UnknownType")] // VIOLATION
+public class UnboundMetadata
+{
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.event.UntypedEventMetadataRule" message="This event type is not specified">
+    <description>Specifying a type will allow Flash builder and the class to have this event exposed in its API</description>
+    <priority>3</priority>
+    <example><![CDATA[[Event(name="myTypeEvent")] // VIOLATION
+public class UnTypedMetadata
+{
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.ExcessiveImportRule" message="A high number of imports can indicate a high degree of coupling within an object. ({0} maximum but {1} actually)">
+    <description>A high number of imports can indicate a high degree of coupling within an object. Rule counts the number of unique imports and reports a violation if the count is above the user defined threshold.</description>
+    <priority>3</priority>
+    <properties>
+      <property name="maximum">
+        <value>15</value>
+      </property>
+    </properties>
+    <example><![CDATA[import blah.blah.Baz;
+import blah.blah.Bif;
+// 18 others from the same package elided
+public class Foo 
+{
+   public function doWork() : void 
+   {
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.TrueFalseConditionRule" message="This test contains a hard coded boolean value. You could remove it by having '{0}'">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[if ( true ) // VIOLATION
+{
+   if ( myCondition == false ) // VIOLATION
+   {
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.DynamicClassRule" message="A class must not be dynamic">
+    <description>When using dynamic classes, you cannot control how the developer will use your class. It makes refactoring really difficult</description>
+    <priority>3</priority>
+    <example><![CDATA[dynamic public class DynamicObject // VIOLATION
+{
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.forbiddentypes.UseObjectTypeRule" message="Do not use Object class">
+    <description>It is a bad practice to use the dynamic class Object. Prefer using strongly typed object, or marker interface in order to avoid silent compilation errors while refactoring</description>
+    <priority>5</priority>
+    <example><![CDATA[public class Foo
+{
+   public var bar : Object; // VIOLATION      
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.NonStaticConstantFieldRule" message="A constant field should be static ({0})">
+    <description/>
+    <priority>1</priority>
+    <example><![CDATA[public class MyObject {
+   public static const MY_STATIC_CONSTANT : String = "myStaticConstant";
+   public const MY_NON_STATIC_CONSTANT : String = "myStaticConstant"; // VIOLATION
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.UselessOverridenFunctionRule" message="This method is empty. This should be removed ({0})">
+    <description>This function is not needed.</description>
+    <priority>3</priority>
+    <example><![CDATA[override protected function createChildren() : void
+{
+   super.createChildren();
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.AvoidProtectedFieldInFinalClassRule" message="Protected accessors are useless in a final class. Make it private ({0})">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[final public class Foo
+{
+   protected var bar : int; // VIOLATION      
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.AvoidUsingWithKeyWordRule" message="You should not use the with keyword. It does not help readability">
+    <description/>
+    <priority>3</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.ArrayFieldWithNoArrayElementTypeRule" message="ArrayElementType metadata is not specified for this array-type field ({0})">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[public class ArrayVO {
+   public var items:Array; //VIOLATION
+
+   [ArrayElementType("model.vo.MenuItemVO")]
+   public var menuItems : Array;
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.ClassAndExtensionAreIdenticalRule" message="The extension name is the same as the class name">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[package com.MyCompany
+{
+   public class SomeClass extends mx.SomeClass // VIOLATION
+   {
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.ProtectedStaticMethodRule" message="This method ({0}) should be private">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[protected static function foo() : void // VIOLATION
+{
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.maintanability.EmptyStatementRule" message="This statement is empty">
+    <description/>
+    <priority>5</priority>
+    <example><![CDATA[protected function foo() : void
+{
+   var i : int = 0;
+   
+   ; // VIOLATION
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.naming.TooShortVariableRule" message="This variable name is too short ({0} characters minimum, but {1} actually)">
+    <description>Detects when a field, local, or parameter has a very short name.</description>
+    <priority>1</priority>
+    <properties>
+      <property name="minimum">
+        <value>3</value>
+      </property>
+    </properties>
+    <example><![CDATA[public class Something 
+{
+   private var q : int = 15; // VIOLATION - Field
+
+   public function foo( as : String ) : void // VIOLATION - Formal 
+   {
+      var r : int = 20 + q; // VIOLATION - Local
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.naming.PackageCaseRule" message="A package name should be lower case ({0})">
+    <description>Detects when a package definition contains upper case characters.</description>
+    <priority>3</priority>
+    <example><![CDATA[
+package com.MyCompany  // VIOLATION <- should be lower case name
+{
+   public class SomeClass 
+   {
+   }
+}
+         ]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.naming.VariableNameEndingWithNumericRule" message="Using digits at the end of a symbol does not help understanging the meaning of it. ({0})">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[
+public class SomeClass 
+{
+   public var correctField1 : int = 0; // VIOLATION <- numeric suffix is forbidden
+}		
+		]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.naming.PropertyHiddenByLocalVariableRule" message="A class property is hidden by this local variable ({0})">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[public class SomeClass 
+{
+   public var myField : int = 0;
+   
+   public function foo() : void
+   {
+   	var myField : int = 9; // VIOLATION
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.naming.WronglyNamedVariableRule" message="This variable ({0}) seems to be incorrectly named. Let your creativity flow">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[
+public class SomeClass 
+{
+   public var myField : int = 0; // VIOLATION <- my prefix is forbidden
+   
+   public function tmpFoo() : void // VIOLATION <- tmp prefix is forbidden
+   {
+   	var tempFoo : int = 9; // VIOLATION <- temp prefix is forbidden
+   }
+}		
+		]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.parsley.InaccessibleMetaDataRule" message="Parsley metadata should not be placed on inaccessible members.">
+    <description>Parsley can only process metadata that is placed onto public members.</description>
+    <priority>1</priority>
+    <example><![CDATA[[MessageHandler]
+private function doSomething() : void // VIOLATION 
+{      
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.parsley.MismatchedManagedEventRule" message="Managed events should have matching [Event] metadata">
+    <description>Each managed event should have matching [Event] metadata.</description>
+    <priority>1</priority>
+    <example><![CDATA[[Event(name="message", type="my.package.MyEvemt")]
+[ManagedEvents(names="messag")] // VIOLATION
+public class MyClass  
+{      
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.parsley.MessageInterceptorSignatureRule" message="The signature of the message interceptor {0} is not correct. {1}.">
+    <description/>
+    <priority>1</priority>
+    <example><![CDATA[
+[MessageInterceptor(type="a.b.MyMessage")]
+public function messageInterceptor( processor : MessageProcessor ) : void
+{
+   processor.proceed();
+}
+
+[MessageInterceptor(type="a.b.MyMessage")]
+public function messageInterceptor() : void // VIOLATION
+{
+}
+
+[MessageInterceptor(type="a.b.MyMessage")]
+public function messageInterceptor( type : MyMessage ) : void // VIOLATION
+{
+   type.something();
+}
+
+[MessageInterceptor(type="a.b.MyMessage")]
+public function messageInterceptor( processor : MessageProcessor, type : MyMessage ) : void // VIOLATION
+{
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.parsley.MisplacedMetaDataRule" message="This metadata {0} is misplaced">
+    <description/>
+    <priority>1</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.parsley.RedundantMessageHandlerTypeAttributeRule" message="This type metadata argument is redundant with the handler argument type">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[
+[MessageHandler(type="a.b.MyMessage")] // VIOLATION
+public function doSomething( message : MyMessage ) : void
+{
+   message.toString();
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.parsley.RedundantMethodAttributeRule" message="This method metadata argument is redundant with the handler name">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[
+[MessageHandler(method="doSomething")] // VIOLATION
+public function doSomething( message : MyMessage ) : void
+{
+   message.toString();
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.parsley.UnknownMetaDataAttributeRule" message="This metadata attribute {0} is unknown">
+    <description/>
+    <priority>1</priority>
+    <example><![CDATA[
+[AsyncInit(x="y")] // VIOLATION
+public class UnknownMetaDataAttribute
+{
+   [Inject(x="y")] // VIOLATION
+   public var inject;
+
+   [MessageHandler(x="y")] // VIOLATION
+   public function messageHandler() : void
+   {
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.performance.DynamicFiltersUsedInPopup" message="A popup should not use dynamic filters">
+    <description>Prefer using embed filters in assets</description>
+    <priority>3</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.performance.CyclomaticComplexityRule" message="This method is too complex. Maximum complexity is {0}, but its cyclomatic complexity was {1}">
+    <description/>
+    <priority>3</priority>
+    <properties>
+      <property name="maximum">
+        <value>10</value>
+      </property>
+    </properties>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.performance.HeavyConstructorRule" message="Constructor must be as lightweight as possible. No control statement allowed, whereas a cyclomatic complexe of {0} has been detected">
+    <description>The Just-In-Time compiler does not compile constructors. Make them as lightweight as possible, or move the complexity of the code to a method called by the constructor. Then the complexity will be compiled by the JIT.</description>
+    <priority>3</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.performance.CreationPolicySetToAllRule" message="creationPolicy to ALL impacts the performance significantly">
+    <description/>
+    <priority>1</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.performance.DeeplyNestedIfRule" message="Nested if statements are not a good design">
+    <description/>
+    <priority>3</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.performance.RecursiveStyleManagerRule" message="Detect calls to the StyleManager that don’t pass “false” as the second parameter">
+    <description>A recursive style manager call can be a very expensive operation, causing parts of the UI to flicker visibly. Instead it is preferable to defer the creation of parts of the UI that depend on a runtime CSS SWF until after the SWF has been loaded. In this case a recursive call is not required.</description>
+    <priority>3</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.sizing.TooManyFunctionRule" message="Too many methods detected ({0} maximum, but {1} actually)">
+    <description>A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.</description>
+    <priority>3</priority>
+    <properties>
+      <property name="maximum">
+        <value>25</value>
+      </property>
+    </properties>
+    <example><![CDATA[public class Foo 
+   {
+      public function doWork() : void {}
+      public function doMoreWork() : void {}
+      public function doWorkAgain() : void {}
+      // [... more more public methods ...]
+   }]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.sizing.TooLongFunctionRule" message="This function is far too long ({0} maximum, but {1} actually)">
+    <description>Violations of this rule usually indicate that the method has too much responsibility. Try to reduce the method size by creating helper methods and removing any copy/pasted code.</description>
+    <priority>3</priority>
+    <properties>
+      <property name="maximum">
+        <value>20</value>
+      </property>
+    </properties>
+    <example><![CDATA[public class Foo 
+   {
+      public function doSomething() : void
+      {
+         System.out.println("Hello world!");
+         System.out.println("Hello world!");
+         // 98 copies omitted for brevity.
+      }
+   }]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.sizing.TooLongSwitchCaseRule" message="Long switch case detected ({0} lines maximum, but {1} actually)">
+    <description>A switch case statement should be either empty, or contain a break, or call another method.</description>
+    <priority>3</priority>
+    <properties>
+      <property name="maximum">
+        <value>3</value>
+      </property>
+    </properties>
+    <example><![CDATA[public class Bar   
+   {
+      public function foo() : void
+      {
+          var i : int = 4;
+          
+          switch( i )
+          {
+             case 1:
+                handleFirstCase();
+                break;
+             case 2: // VIOLATION
+                googleResquest.url = "";
+                handleSecondCaseFirstPart();
+                handleSecondCaseSecondPart();
+                break;
+          }
+      }
+   }]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.sizing.TooManyParametersRule" message="Long parameter list detected ({0} maximum, but {1} actually)">
+    <description>Long parameter lists can indicate that a new object should be created to wrap the numerous parameters.  Basically, try to group the parameters together.</description>
+    <priority>3</priority>
+    <properties>
+      <property name="maximum">
+        <value>4</value>
+      </property>
+    </properties>
+    <example><![CDATA[public class Foo 
+   {
+      public function addData( p0 : int, p1 : int, p2 : int, p3 : int, p4 : int, p5 : int,
+                                             p6 : int, p7 : int, p8 : int, p9 : int, p10 : int ) : void 
+      {
+      }
+   }]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.sizing.TooManyPublicRule" message="Too many public fields or functions detected ({0} maximum, but {1} actually)">
+    <description>A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.</description>
+    <priority>3</priority>
+    <properties>
+      <property name="maximum">
+        <value>15</value>
+      </property>
+    </properties>
+    <example><![CDATA[public class Foo 
+   {
+      public var value : String;
+      public var something : Bar;
+      public var variable : Variable;
+
+      // [... more more public attributes ...]
+
+      public function doWork() : void {}
+      public function doMoreWork() : void {}
+      public function doWorkAgain() : void {}
+
+      // [... more more public methods ...]
+   }]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.sizing.TooManyFieldsRule" message="Too many field detected ({0} maximum, but {1} actually)">
+    <description>Classes that have too many fields could be redesigned to have fewer fields, possibly  through some nested object grouping of some of the information.  For example, a class with  city/state/zipcode fields could instead have one Address field.</description>
+    <priority>3</priority>
+    <properties>
+      <property name="maximum">
+        <value>15</value>
+      </property>
+    </properties>
+    <example><![CDATA[public class Person 
+   {
+      private var one : String;
+      private var two : int;
+      private var three : int;
+
+      [... many more public fields ...]
+
+   }]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.style.ConstructorNonEmptyReturnTypeRule" message="A constructor should not have a return type">
+    <description>Even if this is syntactically correct, there should not be a return type for a constructor.</description>
+    <priority>5</priority>
+    <example><![CDATA[public class VoidConstructor   
+   {
+      public function VoidConstructor() : void // VIOLATION
+      {         
+      }      
+   }]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.style.OverLongLineRule" message="Too long line ({0} maximum, but {1} actually)">
+    <description/>
+    <priority>5</priority>
+    <properties>
+      <property name="maximum">
+        <value>120</value>
+      </property>
+    </properties>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.style.ImportFromSamePackageRule" message="Imports from the same package are not necessary">
+    <description/>
+    <priority>5</priority>
+    <example><![CDATA[package com.adobe.ac
+{
+   import com.adobe.ac.MyModel; // VIOLATION HERE
+
+   public class BigModel   
+   {
+      public var model : MyModel = null;
+   }
+}]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.style.BadFormatLoggerRule" message="The logger is not correctly formatted because {0}">
+    <description/>
+    <priority>5</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.switchrules.SwitchStatementsShouldHaveDefaultRule" message="A switch statement does not contain a default statement">
+    <description>Switch statements should have a default label in order to detect corner cases.</description>
+    <priority>1</priority>
+    <example><![CDATA[public class Foo 
+   {
+      public funciton bar() : void 
+      {
+         var  x : int = 2;
+         switch (x) 
+         {
+            case 2: var j : int = 8;
+         }
+      }
+   }]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.switchrules.NestedSwitchRule" message="Switch must not be nested">
+    <description>As a general practice, switch statement should not be used. Prefer using inheritance. It is even harder to read when switch statements are nested.</description>
+    <priority>3</priority>
+    <example><![CDATA[public function foo( a : Number, b : Number ) : void
+      {
+          switch( a )
+          {
+             case 1:
+                break;
+             case 2:                   
+                switch ( b ) 
+                {
+                  case 3 :
+                     break;
+                  case 4 :
+                     break;
+                }
+                break;                     
+          }
+      }]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.switchrules.TooFewBrancheInSwitchStatementRule" message="There are too few branches in this switch statement ({0} minimum, but {1} actual)">
+    <description>Switch statements are designed for complex branches, and allow branches to share treatment. Using a switch for only 2 branches is ill advised, as switches are not as easy to understand as if. In this case, it's most likely is a good idea to use a if statement</description>
+    <priority>5</priority>
+    <properties>
+      <property name="minimum">
+        <value>3</value>
+      </property>
+    </properties>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.switchrules.IdenticalSwitchCasesRule" message="Two switch cases should not be identical">
+    <description/>
+    <priority>1</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.flexunit.EmptyUnitTest" message="A test should contain at least one assertion">
+    <description/>
+    <priority>3</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.unused.UnusedParameterRule" message="This parameter ({0}) of this function is not used">
+    <description/>
+    <priority>1</priority>
+    <example><![CDATA[public function foo( param1 : Number, param2 : Number, param3 : Number, param4 : Number, param5 : Number ) : void // 4 violations
+      {
+         var i : int = param1;
+      }]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.unused.UnusedLocalVariableRule" message="This variable ({0}) is not used">
+    <description/>
+    <priority>3</priority>
+    <example><![CDATA[public function foo() : void
+      {
+         var i : int = 0;// 1 violation
+      }]]></example>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.unused.UnusedPrivateMethodRule" message="This private method ({0}) does not seem to be used">
+    <description/>
+    <priority>1</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.unused.UnusedFieldRule" message="This private attribute ({0}) does not seem to be used">
+    <description/>
+    <priority>1</priority>
+  </rule>
+  <rule since="" class="com.adobe.ac.pmd.rules.unused.EmptyPrivateMethodRule" message="This private method ({0}) is used but its content is empty">
+    <description/>
+    <priority>1</priority>
+  </rule>
+    
+</ruleset>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-core/src/test/resources/pmd.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-core/src/test/resources/pmd.xml b/FlexPMD/flex-pmd-core/src/test/resources/pmd.xml
new file mode 100644
index 0000000..6b9ac1d
--- /dev/null
+++ b/FlexPMD/flex-pmd-core/src/test/resources/pmd.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<pmd version="4.2.1" timestamp="Fri Aug 08 08:31:02 PDT 2008">
+   <file name="C:/Documents and Settings/Administrator/.hudson/jobs/FlexPmd/workspace/flex-pmd-core/target/test-classes/test/AbstractRowData.as">
+      <violation beginline="41" endline="121" begincolumn="7" endcolumn="7" rule="TooManyFunction" ruleset="Basic As3 Rules" package="" class="AbstractRowData.as" externalInfoUrl="" priority="1">A constructor should not have a return type</violation>
+      <violation beginline="41" endline="118" begincolumn="7" endcolumn="7" rule="TooManyFunction" ruleset="Basic As3 Rules" package="" class="AbstractRowData.as" externalInfoUrl="" priority="1">A constructor should not have a return type</violation>
+      <violation beginline="29" endline="29" begincolumn="9" endcolumn="29" rule="PackageCase" ruleset="Basic Common Flex Rules" package="" class="AbstractRowData.as" externalInfoUrl="" priority="3">A package name should be lower case</violation>
+      <violation beginline="44" endline="44" begincolumn="0" endcolumn="44" rule="DeadCode" ruleset="Basic Common Flex Rules" package="" class="AbstractRowData.as" externalInfoUrl="" priority="3">There are some dead code here.</violation>
+      <violation beginline="49" endline="62" begincolumn="0" endcolumn="9" rule="DeadCode" ruleset="Basic Common Flex Rules" package="" class="AbstractRowData.as" externalInfoUrl="" priority="3">There are some dead code here.</violation>
+      <violation beginline="98" endline="100" begincolumn="12" endcolumn="10" rule="EmptyIfStmt" ruleset="Basic Common Flex Rules" package="" class="AbstractRowData.as" externalInfoUrl="" priority="3">No statements in this if statement</violation>
+      <violation beginline="101" endline="101" begincolumn="0" endcolumn="36" rule="DispatchHardCodedEventName" ruleset="Basic Common Flex Rules" package="" class="AbstractRowData.as" externalInfoUrl="" priority="3">DispatchEvent function must dispatch constant strings</violation>
+      <violation beginline="102" endline="102" begincolumn="0" endcolumn="38" rule="DispatchHardCodedEventName" ruleset="Basic Common Flex Rules" package="" class="AbstractRowData.as" externalInfoUrl="" priority="3">DispatchEvent function must dispatch constant strings</violation>
+      <violation beginline="97" endline="97" begincolumn="0" endcolumn="57" rule="TooShortVariable" ruleset="Basic Common Flex Rules" package="" class="AbstractRowData.as" externalInfoUrl="" priority="5">This variable name is too short</violation>
+   </file>
+   <file name="C:/Documents and Settings/Administrator/.hudson/jobs/FlexPmd/workspace/flex-pmd-core/target/test-classes/test/com/adobe/ac/ncss/BigModel.as">
+      <violation beginline="5" endline="28" begincolumn="7" endcolumn="7" rule="TooManyFunction" ruleset="Basic As3 Rules" package="com.adobe.ac.ncss" class="BigModel.as" externalInfoUrl="" priority="1">A constructor should not have a return type</violation>
+      <violation beginline="8" endline="8" begincolumn="0" endcolumn="22" rule="TooShortVariable" ruleset="Basic Common Flex Rules" package="com.adobe.ac.ncss" class="BigModel.as" externalInfoUrl="" priority="5">This variable name is too short</violation>
+   </file>
+   <file name="C:/Documents and Settings/Administrator/.hudson/jobs/FlexPmd/workspace/flex-pmd-core/target/test-classes/test/com/adobe/ac/ncss/event/DynamicCustomEvent.as">
+      <violation beginline="3" endline="3" begincolumn="0" endcolumn="43" rule="DynamicClass" ruleset="Basic As3 Rules" package="com.adobe.ac.ncss.event" class="DynamicCustomEvent.as" externalInfoUrl="" priority="1">A class must not be dynamic</violation>
+      <violation beginline="5" endline="5" begincolumn="0" endcolumn="31" rule="PublicVariableInCustomEvent" ruleset="Basic As3 Rules" package="com.adobe.ac.ncss.event" class="DynamicCustomEvent.as" externalInfoUrl="" priority="3">No public variables should be inside a custom event</violation>
+   </file>
+   <file name="C:/Documents and Settings/Administrator/.hudson/jobs/FlexPmd/workspace/flex-pmd-core/target/test-classes/test/com/adobe/ac/ncss/event/FirstCustomEvent.as">
+      <violation beginline="0" endline="0" begincolumn="0" endcolumn="0" rule="EventMissingCloneFunction" ruleset="Basic As3 Rules" package="com.adobe.ac.ncss.event" class="FirstCustomEvent.as" externalInfoUrl="" priority="1">The clone event must be overiden in a custom event</violation>
+      <violation beginline="5" endline="5" begincolumn="0" endcolumn="31" rule="PublicVariableInCustomEvent" ruleset="Basic As3 Rules" package="com.adobe.ac.ncss.event" class="FirstCustomEvent.as" externalInfoUrl="" priority="3">No public variables should be inside a custom event</violation>
+   </file>
+   <file name="C:/Documents and Settings/Administrator/.hudson/jobs/FlexPmd/workspace/flex-pmd-core/target/test-classes/test/com/adobe/ac/ncss/mxml/IterationsList.mxml">
+      <violation beginline="18" endline="18" begincolumn="0" endcolumn="72" rule="MoreThanTwoEntryPointsInMxml" ruleset="Basic MXML Rules" package="com.adobe.ac.ncss.mxml" class="IterationsList.mxml" externalInfoUrl="" priority="3">There are more than 2 public variables in this MXML component</violation>
+      <violation beginline="18" endline="18" begincolumn="0" endcolumn="72" rule="MoreThanOneEntryPointInMxml" ruleset="Basic MXML Rules" package="com.adobe.ac.ncss.mxml" class="IterationsList.mxml" externalInfoUrl="" priority="5">There are more than 1 public variable in this MXML component</violation>
+      <violation beginline="20" endline="20" begincolumn="0" endcolumn="86" rule="TooShortVariable" ruleset="Basic Common Flex Rules" package="com.adobe.ac.ncss.mxml" class="IterationsList.mxml" externalInfoUrl="" priority="5">This variable name is too short</violation>
+      <violation beginline="31" endline="31" begincolumn="0" endcolumn="51" rule="TooShortVariable" ruleset="Basic Common Flex Rules" package="com.adobe.ac.ncss.mxml" class="IterationsList.mxml" externalInfoUrl="" priority="5">This variable name is too short</violation>
+   </file>
+   <file name="C:/Documents and Settings/Administrator/.hudson/jobs/FlexPmd/workspace/flex-pmd-core/target/test-classes/test/com/adobe/ac/ncss/SearchBarEvent.as">
+      <violation beginline="0" endline="0" begincolumn="0" endcolumn="0" rule="EventMissingCloneFunction" ruleset="Basic As3 Rules" package="com.adobe.ac.ncss" class="SearchBarEvent.as" externalInfoUrl="" priority="1">The clone event must be overiden in a custom event</violation>
+   </file>
+   <file name="C:/Documents and Settings/Administrator/.hudson/jobs/FlexPmd/workspace/flex-pmd-core/target/test-classes/test/com/adobe/ac/ncss/event/SecondCustomEvent.as">
+      <violation beginline="0" endline="0" begincolumn="0" endcolumn="0" rule="EventMissingCloneFunction" ruleset="Basic As3 Rules" package="com.adobe.ac.ncss.event" class="SecondCustomEvent.as" externalInfoUrl="" priority="1">The clone event must be overiden in a custom event</violation>
+   </file>
+   <file name="C:/Documents and Settings/Administrator/.hudson/jobs/FlexPmd/workspace/flex-pmd-core/target/test-classes/test/com/adobe/ac/ncss/TestResult.as">
+      <violation beginline="61" endline="64" begincolumn="0" endcolumn="11" rule="DeadCode" ruleset="Basic Common Flex Rules" package="com.adobe.ac.ncss" class="TestResult.as" externalInfoUrl="" priority="3">There are some dead code here.</violation>
+   </file>
+   <file name="C:/Documents and Settings/Administrator/.hudson/jobs/FlexPmd/workspace/flex-pmd-core/target/test-classes/test/com/adobe/ac/ncss/VoidConstructor.as">
+      <violation beginline="6" endline="7" begincolumn="7" endcolumn="10" rule="ConstructorNonEmptyReturnType" ruleset="Basic As3 Rules" package="com.adobe.ac.ncss" class="VoidConstructor.as" externalInfoUrl="" priority="3">A constructor should not have a return type</violation>
+      <violation beginline="8" endline="8" begincolumn="0" endcolumn="22" rule="TooShortVariable" ruleset="Basic Common Flex Rules" package="com.adobe.ac.ncss" class="VoidConstructor.as" externalInfoUrl="" priority="5">This variable name is too short</violation>
+   </file>
+</pmd>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-core/src/test/resources/pmd.xsd
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-core/src/test/resources/pmd.xsd b/FlexPMD/flex-pmd-core/src/test/resources/pmd.xsd
new file mode 100644
index 0000000..92c59a3
--- /dev/null
+++ b/FlexPMD/flex-pmd-core/src/test/resources/pmd.xsd
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<!--W3C Schema generated by XMLSpy v2007 rel. 3 sp1 (http://www.altova.com)-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+	<xs:element name="violation">
+		<xs:complexType>
+			<xs:simpleContent>
+				<xs:extension base="xs:string">
+					<xs:attribute name="ruleset" use="required" type="xs:string"/>
+					<xs:attribute name="rule" use="required" type="xs:string"/>
+					<xs:attribute name="priority" use="required" type="xs:int"/>
+					<xs:attribute name="package" use="required" type="xs:string"/>
+					<xs:attribute name="externalInfoUrl" use="required" type="xs:string"/>
+					<xs:attribute name="endline" use="required" type="xs:int"/>
+					<xs:attribute name="endcolumn" use="required" type="xs:int"/>
+					<xs:attribute name="class" use="required" type="xs:string"/>
+					<xs:attribute name="beginline" use="required" type="xs:int"/>
+					<xs:attribute name="begincolumn" use="required" type="xs:int"/>
+				</xs:extension>
+			</xs:simpleContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="pmd">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element ref="file" maxOccurs="unbounded"/>
+			</xs:sequence>
+			<xs:attribute name="version" use="required" type="xs:string"/>
+			<xs:attribute name="timestamp" use="required" type="xs:string"/>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="file">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element ref="violation" maxOccurs="unbounded"/>
+			</xs:sequence>
+			<xs:attribute name="name" use="required" type="xs:string"/>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-cpd-ant-task/pom.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-cpd-ant-task/pom.xml b/FlexPMD/flex-pmd-cpd-ant-task/pom.xml
new file mode 100644
index 0000000..987d68e
--- /dev/null
+++ b/FlexPMD/flex-pmd-cpd-ant-task/pom.xml
@@ -0,0 +1,151 @@
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.adobe.ac</groupId>
+	<artifactId>flex-pmd-cpd-ant-task</artifactId>
+	<name>Adobe Flex CPD Ant task</name>
+	<packaging>jar</packaging>
+
+  <parent>
+	<groupId>com.adobe.ac</groupId>
+	<artifactId>flex-pmd-java-parent</artifactId>
+	<version>1.3-SNAPSHOT</version>
+	<relativePath>../flex-pmd-java-parent/pom.xml</relativePath>
+  </parent>
+  
+
+	<dependencies>
+
+		<dependency>
+			<groupId>pmd</groupId>
+			<artifactId>pmd</artifactId>
+			<version>${pmd.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<version>${project.parent.version}</version>
+			<artifactId>flex-pmd-cpd</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.ant</groupId>
+			<artifactId>ant</artifactId>
+			<version>${ant.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<version>${project.version}</version>
+			<artifactId>flex-pmd-files</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>as3-plugin-utils</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>as3-parser</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>as3-parser-api</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-test-resources</artifactId>
+			<version>${project.parent.version}</version>
+			<classifier>resources</classifier>
+			<type>zip</type>
+			<scope>provided</scope>
+		</dependency>
+
+	</dependencies>
+
+	<build>
+		<testResources>
+			<testResource>
+				<directory>${project.build.directory}/test/generated-resources</directory>
+			</testResource>
+		</testResources>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>unpack-test-resources</id>
+						<phase>generate-resources</phase>
+						<goals>
+							<goal>unpack-dependencies</goal>
+						</goals>
+						<configuration>
+							<includeGroupIds>${project.groupId}</includeGroupIds>
+							<includes>**/*.as,**/*.mxml</includes>
+							<outputDirectory>${project.build.directory}/test/generated-resources</outputDirectory>
+							<excludeTransitive>true</excludeTransitive>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			
+			<plugin>
+				<artifactId>maven-antrun-plugin</artifactId>
+				<version>${maven-antrun-plugin.version}</version>
+				<executions>
+					<execution>
+						<id>package-ant-task</id>
+						<phase>install</phase>
+						<configuration>
+							<tasks>
+								<echo message="Building ant-task" />
+								<mkdir dir="${project.build.directory}/release" />
+								<echo message="" />
+								<echo message="Copying Flex PMD dependencies..." />
+								<copy file="${project.build.directory}/${project.build.finalName}.jar" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.flex-pmd-cpd.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.pmd.pmd.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<echo message="Copying Ant dependencies..." />
+								<copy file="${maven.dependency.com.adobe.ac.flex-pmd-files.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.as3-parser.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.as3-parser-api.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.org.apache.ant.ant.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.as3-plugin-utils.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<echo message="Extracting license..." />
+								<copy file="../flex-pmd-parent/src/etc/header.txt" tofile="${project.build.directory}/release/LICENSE.txt" overwrite="true" />
+								<echo message="Compressing zip..." />
+								<zip destfile="${project.build.directory}/${project.build.finalName}.zip" basedir="${project.build.directory}/release" excludes="*.zip" />
+							</tasks>
+						</configuration>
+						<goals>
+							<goal>run</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			
+		</plugins>
+	</build>
+	
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-cpd-ant-task/src/main/java/com/adobe/ac/cpd/ant/FlexCpdAntTask.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-cpd-ant-task/src/main/java/com/adobe/ac/cpd/ant/FlexCpdAntTask.java b/FlexPMD/flex-pmd-cpd-ant-task/src/main/java/com/adobe/ac/cpd/ant/FlexCpdAntTask.java
new file mode 100644
index 0000000..1f1a438
--- /dev/null
+++ b/FlexPMD/flex-pmd-cpd-ant-task/src/main/java/com/adobe/ac/cpd/ant/FlexCpdAntTask.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.cpd.ant;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sourceforge.pmd.cpd.CPD;
+import net.sourceforge.pmd.cpd.FileReporter;
+import net.sourceforge.pmd.cpd.Renderer;
+import net.sourceforge.pmd.cpd.ReportException;
+import net.sourceforge.pmd.cpd.XMLRenderer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
+
+import com.adobe.ac.cpd.FlexLanguage;
+import com.adobe.ac.cpd.FlexTokenizer;
+import com.adobe.ac.pmd.LoggerUtils;
+
+public class FlexCpdAntTask extends Task
+{
+   private String                encoding          = System.getProperty( "file.encoding" );
+   private final List< FileSet > filesets          = new ArrayList< FileSet >();
+   private int                   minimumTokenCount = FlexTokenizer.DEFAULT_MINIMUM_TOKENS;
+   private File                  outputFile;
+
+   public void addFileset( final FileSet set )
+   {
+      filesets.add( set );
+   }
+
+   @Override
+   public void execute()
+   {
+      try
+      {
+         validateFields();
+         new LoggerUtils().loadConfiguration();
+
+         log( "Starting run, minimumTokenCount is "
+                    + minimumTokenCount,
+              Project.MSG_INFO );
+
+         log( "Tokenizing files",
+              Project.MSG_INFO );
+         final CPD cpd = new CPD( minimumTokenCount, new FlexLanguage() );
+         cpd.setEncoding( encoding );
+         tokenizeFiles( cpd );
+
+         log( "Starting to analyze code",
+              Project.MSG_INFO );
+         final long timeTaken = analyzeCode( cpd );
+         log( "Done analyzing code; that took "
+               + timeTaken + " milliseconds" );
+
+         log( "Generating report",
+              Project.MSG_INFO );
+         report( cpd );
+      }
+      catch ( final IOException ioe )
+      {
+         log( ioe.toString(),
+              Project.MSG_ERR );
+         throw new BuildException( "IOException during task execution", ioe );
+      }
+      catch ( final ReportException re )
+      {
+         log( re.toString(),
+              Project.MSG_ERR );
+         throw new BuildException( "ReportException during task execution", re );
+      }
+   }
+
+   public void setEncoding( final String encodingValue )
+   {
+      encoding = encodingValue;
+   }
+
+   public void setMinimumTokenCount( final int minimumTokenCountToBeSet )
+   {
+      minimumTokenCount = minimumTokenCountToBeSet;
+   }
+
+   public void setOutputFile( final File outputFileToBeSet )
+   {
+      outputFile = outputFileToBeSet;
+   }
+
+   private long analyzeCode( final CPD cpd )
+   {
+      final long start = System.currentTimeMillis();
+      cpd.go();
+      final long stop = System.currentTimeMillis();
+      return stop
+            - start;
+   }
+
+   private File getFile( final DirectoryScanner directoryScanner,
+                         final String includedFile )
+   {
+      final File file = new File( directoryScanner.getBasedir()
+            + System.getProperty( "file.separator" ) + includedFile );
+      log( "Tokenizing "
+                 + file.getAbsolutePath(),
+           Project.MSG_VERBOSE );
+      return file;
+   }
+
+   private void report( final CPD cpd ) throws ReportException
+   {
+      final Renderer renderer = new XMLRenderer( encoding );
+      FileReporter reporter;
+      if ( outputFile == null )
+      {
+         reporter = new FileReporter( encoding );
+      }
+      else if ( outputFile.isAbsolute() )
+      {
+         reporter = new FileReporter( outputFile, encoding );
+      }
+      else
+      {
+         reporter = new FileReporter( new File( getProject().getBaseDir(), outputFile.toString() ), encoding );
+      }
+      reporter.report( renderer.render( cpd.getMatches() ) );
+   }
+
+   private void tokenizeFiles( final CPD cpd ) throws IOException
+   {
+      for ( final FileSet fileSet : filesets )
+      {
+         final DirectoryScanner directoryScanner = fileSet.getDirectoryScanner( getProject() );
+         final String[] includedFiles = directoryScanner.getIncludedFiles();
+         for ( final String includedFile : includedFiles )
+         {
+            cpd.add( getFile( directoryScanner,
+                              includedFile ) );
+         }
+      }
+   }
+
+   private void validateFields()
+   {
+      if ( minimumTokenCount == 0 )
+      {
+         throw new BuildException( "minimumTokenCount is required and must be greater than zero" );
+      }
+      else if ( filesets.isEmpty() )
+      {
+         throw new BuildException( "Must include at least one FileSet" );
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-cpd-ant-task/src/test/java/com/adobe/ac/cpd/ant/FlexCpdAntTaskTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-cpd-ant-task/src/test/java/com/adobe/ac/cpd/ant/FlexCpdAntTaskTest.java b/FlexPMD/flex-pmd-cpd-ant-task/src/test/java/com/adobe/ac/cpd/ant/FlexCpdAntTaskTest.java
new file mode 100644
index 0000000..c4aaf38
--- /dev/null
+++ b/FlexPMD/flex-pmd-cpd-ant-task/src/test/java/com/adobe/ac/cpd/ant/FlexCpdAntTaskTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.cpd.ant;
+
+import java.io.File;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.FileSet;
+import org.junit.Test;
+
+import com.adobe.ac.pmd.FlexPmdTestBase;
+
+public class FlexCpdAntTaskTest extends FlexPmdTestBase
+{
+   @Test
+   public void testExecute()
+   {
+      final FlexCpdAntTask task = new FlexCpdAntTask();
+      final FileSet set = new FileSet();
+      final Project project = new Project();
+
+      set.setDir( getTestDirectory() );
+      task.setProject( project );
+      task.addFileset( set );
+      task.execute();
+   }
+
+   @Test
+   public void testParameter()
+   {
+      final FlexCpdAntTask task = new FlexCpdAntTask();
+      final String encodingValue = "encoding";
+      final String desc = "desc";
+      final int minimumTokenCountToBeSet = 10;
+      final File outputFile = null;
+
+      task.setDescription( desc );
+      task.setEncoding( encodingValue );
+      task.setOutputFile( outputFile );
+      task.setMinimumTokenCount( minimumTokenCountToBeSet );
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-cpd-command-line/pom.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-cpd-command-line/pom.xml b/FlexPMD/flex-pmd-cpd-command-line/pom.xml
new file mode 100644
index 0000000..c7d4729
--- /dev/null
+++ b/FlexPMD/flex-pmd-cpd-command-line/pom.xml
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.adobe.ac</groupId>
+	<artifactId>flex-pmd-cpd-command-line</artifactId>
+	<name>Adobe Flex CPD Command line</name>
+	<description />
+	<packaging>jar</packaging>
+
+  <parent>
+	<groupId>com.adobe.ac</groupId>
+	<artifactId>flex-pmd-java-parent</artifactId>
+	<version>1.3-SNAPSHOT</version>
+	<relativePath>../flex-pmd-java-parent/pom.xml</relativePath>
+  </parent>
+  
+
+	<properties>
+		<maven.jar.plugin.version>2.2</maven.jar.plugin.version>
+	</properties>
+
+	<dependencies>
+
+
+		<dependency>
+			<groupId>com.martiansoftware</groupId>
+			<artifactId>jsap</artifactId>
+			<version>${jsap.version}</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<version>${project.version}</version>
+			<artifactId>flex-pmd-command-line-api</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>pmd</groupId>
+			<artifactId>pmd</artifactId>
+			<version>${pmd.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<version>${project.parent.version}</version>
+			<artifactId>flex-pmd-cpd</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<version>${project.version}</version>
+			<artifactId>flex-pmd-files</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>as3-plugin-utils</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>as3-parser</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>as3-parser-api</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-lang</groupId>
+			<artifactId>commons-lang</artifactId>
+			<version>${commons-lang.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-test-resources</artifactId>
+			<version>${project.parent.version}</version>
+			<classifier>resources</classifier>
+			<type>zip</type>
+			<scope>provided</scope>
+		</dependency>
+
+	</dependencies>
+
+	<build>
+
+		<testResources>
+			<testResource>
+				<directory>${project.build.directory}/test/generated-resources</directory>
+			</testResource>
+		</testResources>
+	
+		<plugins>
+		
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>unpack-test-resources</id>
+						<phase>generate-resources</phase>
+						<goals>
+							<goal>unpack-dependencies</goal>
+						</goals>
+						<configuration>
+							<includeGroupIds>${project.groupId}</includeGroupIds>
+							<includes>**/*.as,**/*.mxml</includes>
+							<outputDirectory>${project.build.directory}/test/generated-resources</outputDirectory>
+							<excludeTransitive>true</excludeTransitive>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<version>${maven.jar.plugin.version}</version>
+				<configuration>
+					<archive>
+						<manifest>
+							<mainClass>com.adobe.ac.cpd.commandline.FlexCPD</mainClass>
+							<packageName>com.adobe.ac.cpd.commandline</packageName>
+							<addClasspath>true</addClasspath>
+						</manifest>
+					</archive>
+				</configuration>
+			</plugin>
+			<plugin>
+				<artifactId>maven-antrun-plugin</artifactId>
+				<version>${maven-antrun-plugin.version}</version>
+				<executions>
+					<execution>
+						<id>package-ant-task</id>
+						<phase>install</phase>
+						<configuration>
+							<tasks>
+								<echo message="Building ant-task" />
+								<mkdir dir="${project.build.directory}/release" />
+								<echo message="" />
+								<echo message="Copying Flex CPD dependencies..." />
+								<copy file="${project.build.directory}/${project.build.finalName}.jar" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.flex-pmd-command-line-api.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.as3-parser-api.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.as3-parser.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.flex-pmd-cpd.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.flex-pmd-files.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.as3-plugin-utils.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<echo message="Copying Command line dependencies..." />
+								<copy file="${maven.dependency.pmd.pmd.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.commons-lang.commons-lang.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.martiansoftware.jsap.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<echo message="Extracting license..." />
+								<copy file="../flex-pmd-parent/src/etc/header.txt" tofile="${project.build.directory}/release/LICENSE.txt" overwrite="true" />
+								<echo message="Compressing zip..." />
+								<zip destfile="${project.build.directory}/${project.build.finalName}.zip" basedir="${project.build.directory}/release" excludes="*.zip" />
+							</tasks>
+						</configuration>
+						<goals>
+							<goal>run</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/CpdCommandLineOptions.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/CpdCommandLineOptions.java b/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/CpdCommandLineOptions.java
new file mode 100644
index 0000000..a359eb4
--- /dev/null
+++ b/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/CpdCommandLineOptions.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.cpd.commandline;
+
+import com.adobe.ac.pmd.ICommandLineOptions;
+
+public enum CpdCommandLineOptions implements ICommandLineOptions
+{
+   MINIMUM_TOKENS("minimumTokens"), OUTPUT_FILE("outputFile");
+
+   private String name;
+
+   private CpdCommandLineOptions( final String nameToBeSet )
+   {
+      name = nameToBeSet;
+   }
+
+   @Override
+   public String toString()
+   {
+      return name;
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/FlexCPD.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/FlexCPD.java b/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/FlexCPD.java
new file mode 100644
index 0000000..c43042f
--- /dev/null
+++ b/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/FlexCPD.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.cpd.commandline;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import net.sourceforge.pmd.PMDException;
+import net.sourceforge.pmd.cpd.CPD;
+import net.sourceforge.pmd.cpd.FileReporter;
+import net.sourceforge.pmd.cpd.Renderer;
+import net.sourceforge.pmd.cpd.ReportException;
+import net.sourceforge.pmd.cpd.XMLRenderer;
+
+import com.adobe.ac.cpd.FlexLanguage;
+import com.adobe.ac.cpd.FlexTokenizer;
+import com.adobe.ac.pmd.CommandLineOptions;
+import com.adobe.ac.pmd.CommandLineUtils;
+import com.adobe.ac.pmd.ICommandLineOptions;
+import com.adobe.ac.pmd.LoggerUtils;
+import com.adobe.ac.pmd.files.IFlexFile;
+import com.adobe.ac.pmd.files.impl.FileUtils;
+import com.martiansoftware.jsap.JSAP;
+import com.martiansoftware.jsap.JSAPException;
+import com.martiansoftware.jsap.JSAPResult;
+
+public final class FlexCPD
+{
+   private static JSAPResult        config;
+   private static final String      ENCODING = System.getProperty( "file.encoding" );
+   private static final Logger      LOGGER   = Logger.getLogger( FlexCPD.class.getName() );
+   private static FlexCpdParameters parameters;
+
+   public static void main( final String[] args ) throws JSAPException,
+                                                 URISyntaxException,
+                                                 IOException,
+                                                 ReportException,
+                                                 PMDException
+   {
+      new LoggerUtils().loadConfiguration();
+      startFlexCPD( args );
+      LOGGER.info( "FlexCPD terminated" );
+      System.exit( 0 ); // NOPMD
+   }
+
+   static boolean areCommandLineOptionsCorrect( final String[] args ) throws JSAPException
+   {
+      final JSAP jsap = new JSAP();
+      config = parseCommandLineArguments( args,
+                                          jsap );
+
+      if ( !config.success() )
+      {
+         LOGGER.log( Level.SEVERE,
+                     "Usage: java "
+                           + FlexCPD.class.getName() + " " + jsap.getUsage() );
+      }
+
+      return config.success();
+   }
+
+   static String getParameterValue( final ICommandLineOptions option )
+   {
+      return config.getString( option.toString() );
+   }
+
+   static boolean startFlexCPD( final String[] args ) throws JSAPException,
+                                                     URISyntaxException,
+                                                     IOException,
+                                                     ReportException,
+                                                     PMDException
+   {
+      if ( areCommandLineOptionsCorrect( args ) )
+      {
+         final String minimumTokens = getParameterValue( CpdCommandLineOptions.MINIMUM_TOKENS );
+         final String source = getParameterValue( CommandLineOptions.SOURCE_DIRECTORY );
+         final File sourceDirectory = source.contains( "," ) ? null
+                                                            : new File( source );
+         final List< File > sourceList = CommandLineUtils.computeSourceList( source );
+         final File outputDirectory = new File( getParameterValue( CpdCommandLineOptions.OUTPUT_FILE ) );
+
+         parameters = new FlexCpdParameters( outputDirectory,
+                                             minimumTokens == null ? FlexTokenizer.DEFAULT_MINIMUM_TOKENS
+                                                                  : Integer.valueOf( minimumTokens ),
+                                             sourceDirectory,
+                                             sourceList );
+         LOGGER.info( "Starting run, minimumTokenCount is "
+               + parameters.getMinimumTokenCount() );
+
+         LOGGER.info( "Tokenizing files" );
+         final CPD cpd = new CPD( parameters.getMinimumTokenCount(), new FlexLanguage() );
+
+         cpd.setEncoding( ENCODING );
+         tokenizeFiles( cpd );
+
+         LOGGER.info( "Starting to analyze code" );
+         final long timeTaken = analyzeCode( cpd );
+         LOGGER.info( "Done analyzing code; that took "
+               + timeTaken + " milliseconds" );
+
+         LOGGER.info( "Generating report" );
+         report( cpd );
+      }
+
+      return config.success();
+   }
+
+   private static long analyzeCode( final CPD cpd )
+   {
+      final long start = System.currentTimeMillis();
+      cpd.go();
+      final long stop = System.currentTimeMillis();
+      return stop
+            - start;
+   }
+
+   private static JSAPResult parseCommandLineArguments( final String[] args,
+                                                        final JSAP jsap ) throws JSAPException
+   {
+      CommandLineUtils.registerParameter( jsap,
+                                          CommandLineOptions.SOURCE_DIRECTORY,
+                                          true );
+      CommandLineUtils.registerParameter( jsap,
+                                          CpdCommandLineOptions.OUTPUT_FILE,
+                                          true );
+      CommandLineUtils.registerParameter( jsap,
+                                          CpdCommandLineOptions.MINIMUM_TOKENS,
+                                          false );
+      CommandLineUtils.registerParameter( jsap,
+                                          CommandLineOptions.EXLUDE_PACKAGE,
+                                          false );
+
+      return jsap.parse( args );
+   }
+
+   private static void report( final CPD cpd ) throws ReportException,
+                                              IOException
+   {
+      if ( !cpd.getMatches().hasNext() )
+      {
+         LOGGER.info( "No duplicates over "
+               + parameters.getMinimumTokenCount() + " tokens found" );
+      }
+      final Renderer renderer = new XMLRenderer( ENCODING );
+
+      if ( !parameters.getOutputFile().exists() )
+      {
+         if ( parameters.getOutputFile().createNewFile() == false )
+         {
+            LOGGER.warning( "Could not create a new output file" );
+         }
+      }
+
+      final FileReporter reporter = new FileReporter( parameters.getOutputFile(), ENCODING );
+      reporter.report( renderer.render( cpd.getMatches() ) );
+   }
+
+   private static void tokenizeFiles( final CPD cpd ) throws IOException,
+                                                     PMDException
+   {
+      final Map< String, IFlexFile > files = FileUtils.computeFilesList( parameters.getSourceDirectory(),
+                                                                         parameters.getSourceList(),
+                                                                         "",
+                                                                         null );
+
+      for ( final Entry< String, IFlexFile > fileEntry : files.entrySet() )
+      {
+         cpd.add( new File( fileEntry.getValue().getFilePath() ) ); // NOPMD
+      }
+   }
+
+   private FlexCPD()
+   {
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/FlexCpdParameters.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/FlexCpdParameters.java b/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/FlexCpdParameters.java
new file mode 100644
index 0000000..dfdd0b3
--- /dev/null
+++ b/FlexPMD/flex-pmd-cpd-command-line/src/main/java/com/adobe/ac/cpd/commandline/FlexCpdParameters.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.cpd.commandline;
+
+import java.io.File;
+import java.util.List;
+
+public class FlexCpdParameters
+{
+   private final Integer      minimumTokenCount;
+   private final File         outputFile;
+   private final File         sourceDirectory;
+   private final List< File > sourceList;
+
+   public FlexCpdParameters( final File outputFileToBeSet,
+                             final Integer minimumTokenCountToBeSet,
+                             final File sourceDirectoryToBeSet,
+                             final List< File > sourceListToBeSet )
+   {
+      super();
+      minimumTokenCount = minimumTokenCountToBeSet;
+      outputFile = outputFileToBeSet;
+      sourceDirectory = sourceDirectoryToBeSet;
+      sourceList = sourceListToBeSet;
+   }
+
+   public final Integer getMinimumTokenCount()
+   {
+      return minimumTokenCount;
+   }
+
+   public final File getOutputFile()
+   {
+      return outputFile;
+   }
+
+   public final File getSourceDirectory()
+   {
+      return sourceDirectory;
+   }
+
+   public List< File > getSourceList()
+   {
+      return sourceList;
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-cpd-command-line/src/test/java/com/adobe/ac/cpd/commandline/FlexCPDTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-cpd-command-line/src/test/java/com/adobe/ac/cpd/commandline/FlexCPDTest.java b/FlexPMD/flex-pmd-cpd-command-line/src/test/java/com/adobe/ac/cpd/commandline/FlexCPDTest.java
new file mode 100644
index 0000000..9526b0a
--- /dev/null
+++ b/FlexPMD/flex-pmd-cpd-command-line/src/test/java/com/adobe/ac/cpd/commandline/FlexCPDTest.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.cpd.commandline;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import net.sourceforge.pmd.PMDException;
+import net.sourceforge.pmd.cpd.ReportException;
+
+import org.junit.Test;
+
+import com.adobe.ac.pmd.CommandLineOptions;
+import com.adobe.ac.pmd.FlexPmdTestBase;
+import com.martiansoftware.jsap.JSAPException;
+
+public class FlexCPDTest extends FlexPmdTestBase
+{
+   @Test
+   public void testAreCommandLineOptionsCorrect() throws FileNotFoundException,
+                                                 JSAPException,
+                                                 PMDException,
+                                                 URISyntaxException
+   {
+      assertFalse( FlexCPD.areCommandLineOptionsCorrect( new String[]
+      {} ) );
+
+      assertFalse( FlexCPD.areCommandLineOptionsCorrect( new String[]
+      { "-y",
+                  "sourceDirectory",
+                  "-p",
+                  "outPutDirectory" } ) );
+
+      assertTrue( FlexCPD.areCommandLineOptionsCorrect( new String[]
+      { "-s",
+                  "sourceDirectory",
+                  "-o",
+                  "target",
+                  "-m",
+                  "50" } ) );
+
+      assertTrue( FlexCPD.areCommandLineOptionsCorrect( new String[]
+      { "-s",
+                  "sourceDirectory",
+                  "-o",
+                  "target" } ) );
+   }
+
+   @Test
+   public void testGetCommandLineValue() throws JSAPException
+   {
+      FlexCPD.areCommandLineOptionsCorrect( new String[]
+      { "-s",
+                  "sourceDirectory",
+                  "-o",
+                  "target",
+                  "-m",
+                  "25" } );
+
+      assertEquals( "sourceDirectory",
+                    FlexCPD.getParameterValue( CommandLineOptions.SOURCE_DIRECTORY ) );
+      assertEquals( "target",
+                    FlexCPD.getParameterValue( CpdCommandLineOptions.OUTPUT_FILE ) );
+      assertEquals( "25",
+                    FlexCPD.getParameterValue( CpdCommandLineOptions.MINIMUM_TOKENS ) );
+   }
+
+   @Test
+   public void testStartFlexCPD() throws JSAPException,
+                                 PMDException,
+                                 URISyntaxException,
+                                 IOException,
+                                 ReportException
+   {
+      final String[] args = new String[]
+      { "-s",
+                  getTestDirectory().getAbsolutePath(),
+                  "-o",
+                  new File( "target/cpd.xml" ).getAbsolutePath(),
+                  "--excludePackage",
+                  "cairngorm." };
+
+      FlexCPD.startFlexCPD( args );
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-cpd-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-cpd-maven-plugin/pom.xml b/FlexPMD/flex-pmd-cpd-maven-plugin/pom.xml
new file mode 100644
index 0000000..7249bb3
--- /dev/null
+++ b/FlexPMD/flex-pmd-cpd-maven-plugin/pom.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.adobe.ac</groupId>
+	<artifactId>flex-pmd-cpd-maven-plugin</artifactId>
+	<name>Adobe Flex CPD Maven plugin</name>
+	<packaging>maven-plugin</packaging>
+
+  <parent>
+	<groupId>com.adobe.ac</groupId>
+	<artifactId>flex-pmd-java-parent</artifactId>
+	<version>1.3-SNAPSHOT</version>
+	<relativePath>../flex-pmd-java-parent/pom.xml</relativePath>
+  </parent>
+  
+	<dependencies>
+		<dependency>
+			<groupId>pmd</groupId>
+			<artifactId>pmd</artifactId>
+			<version>${pmd.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-api</artifactId>
+			<version>${maven-plugin-api.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven.reporting</groupId>
+			<artifactId>maven-reporting-impl</artifactId>
+			<version>${maven-reporting-impl.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven.plugins</groupId>
+			<artifactId>maven-pmd-plugin</artifactId>
+			<version>${maven-pmd-plugin.version}</version>
+			<type>maven-plugin</type>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-core</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-cpd</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-files</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-test-resources</artifactId>
+			<version>${project.parent.version}</version>
+			<classifier>resources</classifier>
+			<type>zip</type>
+			<scope>provided</scope>
+		</dependency>
+
+	</dependencies>
+
+	<build>
+
+		<testResources>
+			<testResource>
+				<directory>${project.build.directory}/test/generated-resources</directory>
+			</testResource>
+		</testResources>
+
+		<plugins>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>unpack-test-resources</id>
+						<phase>generate-resources</phase>
+						<goals>
+							<goal>unpack-dependencies</goal>
+						</goals>
+						<configuration>
+							<includeGroupIds>${project.groupId}</includeGroupIds>
+							<includes>**/*.as,**/*.mxml</includes>
+							<outputDirectory>${project.build.directory}/test/generated-resources</outputDirectory>
+							<excludeTransitive>true</excludeTransitive>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>


Mime
View raw message