flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cd...@apache.org
Subject [14/51] [partial] Refactored the PMD Maven build - Adjusted the directory structure - Fixed a lot of compile problems - Fixed the maven setup - Made PMD build with Flexmojos 7.1.0 and Apache Flex 4.13.0 - Fixed a few UnitTests
Date Tue, 26 Aug 2014 22:43:45 GMT
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/FlexRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/FlexRuleTest.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/FlexRuleTest.java
new file mode 100644
index 0000000..e18b6d8
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/FlexRuleTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.pmd.rules.core;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import junit.framework.Assert;
+import net.sourceforge.pmd.PMDException;
+
+import org.junit.Test;
+
+import com.adobe.ac.pmd.FlexPmdTestBase;
+import com.adobe.ac.pmd.files.FileSetUtils;
+import com.adobe.ac.pmd.files.IFlexFile;
+import com.adobe.ac.pmd.nodes.impl.NodeFactory;
+import com.adobe.ac.pmd.parser.IParserNode;
+import com.adobe.ac.pmd.parser.NodeKind;
+
+public class FlexRuleTest extends FlexPmdTestBase
+{
+   public class EmptyIfStmtRule extends AbstractAstFlexRule
+   {
+      /*
+       * (non-Javadoc)
+       * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+       */
+      @Override
+      protected final ViolationPriority getDefaultPriority()
+      {
+         return ViolationPriority.NORMAL;
+      }
+
+      /*
+       * (non-Javadoc)
+       * @see
+       * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#visitIf(com.adobe.ac
+       * .pmd .parser.IParserNode)
+       */
+      @Override
+      protected final void visitIf( final IParserNode ast )
+      {
+         super.visitIf( ast );
+
+         if ( isBlockEmpty( ast.getChild( 1 ) ) )
+         {
+            addViolation( ast );
+         }
+      }
+
+      private boolean isBlockEmpty( final IParserNode block )
+      {
+         return block.is( NodeKind.BLOCK )
+               && block.numChildren() == 0 || block.is( NodeKind.STMT_EMPTY );
+      }
+   }
+
+   @Test
+   public void testExclusions() throws PMDException
+   {
+      final AbstractFlexRule rule = new EmptyIfStmtRule();
+      final IFlexFile duaneMxml = getTestFiles().get( "bug.Duane.mxml" );
+      final Set< String > excludes = new HashSet< String >();
+
+      excludes.add( "" );
+
+      final int noExclusionViolationsLength = rule.processFile( duaneMxml,
+                                                                NodeFactory.createPackage( FileSetUtils.buildAst( duaneMxml ) ),
+                                                                getTestFiles() )
+                                                  .size();
+
+      rule.setExcludes( excludes );
+      final int exclusionViolationsLength = rule.processFile( duaneMxml,
+                                                              NodeFactory.createPackage( FileSetUtils.buildAst( duaneMxml ) ),
+                                                              getTestFiles() )
+                                                .size();
+
+      Assert.assertTrue( noExclusionViolationsLength > exclusionViolationsLength );
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/IgnoreRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/IgnoreRuleTest.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/IgnoreRuleTest.java
new file mode 100644
index 0000000..49d1140
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/IgnoreRuleTest.java
@@ -0,0 +1,129 @@
+/*
+ * 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.pmd.rules.core;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import com.adobe.ac.pmd.FlexPmdTestBase;
+import com.adobe.ac.pmd.IFlexViolation;
+import com.adobe.ac.pmd.files.IFlexFile;
+
+public class IgnoreRuleTest extends FlexPmdTestBase
+{
+   private class IgnoredRule extends AbstractFlexRule
+   {
+      private final IFlexFile currentFile;
+
+      protected IgnoredRule( final IFlexFile file )
+      {
+         super();
+         currentFile = file;
+      }
+
+      @Override
+      public String getName()
+      {
+         return "com.adobe.ac.Ignored";
+      }
+
+      @Override
+      protected List< IFlexViolation > findViolationsInCurrentFile()
+      {
+         return null;
+      }
+
+      @Override
+      protected IFlexFile getCurrentFile()
+      {
+         return currentFile;
+      }
+
+      @Override
+      protected ViolationPriority getDefaultPriority()
+      {
+         return ViolationPriority.LOW;
+      }
+
+      @Override
+      protected boolean isConcernedByTheCurrentFile()
+      {
+         return true;
+      }
+   }
+   private static final String AS3_LINE  = "var i : int;";
+   private static final String MXML_LINE = "addedToStage=\"callLater( myFunction )\"";
+
+   private final IgnoredRule   ruleWithAsFile;
+   private final IgnoredRule   ruleWithMxmlFile;
+
+   public IgnoreRuleTest()
+   {
+      ruleWithAsFile = new IgnoredRule( getTestFiles().get( "AbstractRowData.as" ) );
+      ruleWithMxmlFile = new IgnoredRule( getTestFiles().get( "Main.mxml" ) );
+   }
+
+   @Test
+   public final void testIsViolationIgnored()
+   {
+      isIgnored( " NO PMD" );
+   }
+
+   @Test
+   public final void testIsViolationIgnoredCollapsed()
+   {
+      isIgnored( " NOPMD" );
+   }
+
+   @Test
+   public final void testIsViolationIgnoredWithFullCollapsed()
+   {
+      isIgnored( "NOPMD" );
+   }
+
+   @Test
+   public final void testIsViolationIgnoredWithLowerCase()
+   {
+      isIgnored( " No PMD" );
+   }
+
+   private void isIgnored( final String noPmd )
+   {
+      assertTrue( ruleWithAsFile.isViolationIgnored( AS3_LINE
+            + " //" + noPmd ) );
+      assertFalse( ruleWithAsFile.isViolationIgnored( AS3_LINE
+            + " //" + noPmd + " AlertShow" ) );
+      assertTrue( ruleWithAsFile.isViolationIgnored( AS3_LINE
+            + " //" + noPmd + " IgnoreTest$Ignored" ) );
+      assertTrue( ruleWithAsFile.isViolationIgnored( AS3_LINE
+            + " //" + noPmd + " adobe.ac.pmd.rules.core.IgnoreTest$Ignored" ) );
+      assertFalse( ruleWithAsFile.isViolationIgnored( AS3_LINE ) );
+      assertTrue( ruleWithMxmlFile.isViolationIgnored( MXML_LINE
+            + " <!--" + noPmd ) );
+      assertFalse( ruleWithMxmlFile.isViolationIgnored( MXML_LINE
+            + " <!--" + noPmd + " AlertShow" ) );
+      assertTrue( ruleWithMxmlFile.isViolationIgnored( MXML_LINE
+            + " <!--" + noPmd + " IgnoreTest$Ignored" ) );
+      assertTrue( ruleWithMxmlFile.isViolationIgnored( MXML_LINE
+            + " <!--" + noPmd + " adobe.ac.pmd.rules.core.IgnoreTest$Ignored" ) );
+      assertFalse( ruleWithMxmlFile.isViolationIgnored( MXML_LINE ) );
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/TestAbstractAstFlexRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/TestAbstractAstFlexRule.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/TestAbstractAstFlexRule.java
new file mode 100644
index 0000000..c2ea0b5
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/TestAbstractAstFlexRule.java
@@ -0,0 +1,146 @@
+/*
+ * 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.pmd.rules.core;
+
+import net.sourceforge.pmd.PMDException;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.adobe.ac.pmd.FlexPmdTestBase;
+import com.adobe.ac.pmd.files.FileSetUtils;
+import com.adobe.ac.pmd.files.IFlexFile;
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.IFunction;
+import com.adobe.ac.pmd.nodes.impl.NodeFactory;
+import com.adobe.ac.pmd.parser.IParserNode;
+
+public class TestAbstractAstFlexRule extends FlexPmdTestBase
+{
+   public class AllRule extends AbstractAstFlexRule
+   {
+      protected boolean catchVisited     = false;
+      protected boolean emptyVisited     = false;
+      protected boolean interfaceVisited = false;
+      protected boolean switchVisited    = false;
+      protected boolean whileVisited     = false;
+
+      @Override
+      protected void findViolations( final IClass classNode )
+      {
+         super.findViolations( classNode );
+
+         addViolation( classNode );
+         addViolation( classNode.getInternalNode(),
+                       "first",
+                       "second" );
+         addViolation( classNode,
+                       "first",
+                       "second" );
+      }
+
+      @Override
+      protected void findViolations( final IFunction function )
+      {
+         super.findViolations( function );
+
+         addViolation( function );
+         addViolation( function,
+                       "toto" );
+      }
+
+      @Override
+      protected ViolationPriority getDefaultPriority()
+      {
+         return ViolationPriority.NORMAL;
+      }
+
+      @Override
+      protected void visitCatch( final IParserNode catchNode )
+      {
+         super.visitCatch( catchNode );
+
+         catchVisited = true;
+      }
+
+      @Override
+      protected void visitEmptyStatetement( final IParserNode statementNode )
+      {
+         super.visitEmptyStatetement( statementNode );
+
+         emptyVisited = true;
+      }
+
+      @Override
+      protected void visitInterface( final IParserNode interfaceNode )
+      {
+         super.visitInterface( interfaceNode );
+
+         interfaceVisited = true;
+      }
+
+      @Override
+      protected void visitSwitch( final IParserNode switchNode )
+      {
+         super.visitSwitch( switchNode );
+
+         switchVisited = true;
+      }
+
+      @Override
+      protected void visitWhile( final IParserNode whileNode )
+      {
+         super.visitWhile( whileNode );
+
+         whileVisited = true;
+      }
+   }
+
+   @Test
+   public void testVisit() throws PMDException
+   {
+      final AllRule rule = new AllRule();
+
+      processFile( rule,
+                   "bug.Duane.mxml" );
+      processFile( rule,
+                   "PngEncoder.as" );
+      processFile( rule,
+                   "Color.as" );
+      processFile( rule,
+                   "AbstractRowData.as" );
+      processFile( rule,
+                   "com.adobe.ac.ncss.LongSwitch.as" );
+      processFile( rule,
+                   "com.adobe.ac.ncss.BigImporterModel.as" );
+
+      Assert.assertTrue( rule.catchVisited );
+      Assert.assertTrue( rule.emptyVisited );
+      Assert.assertTrue( rule.interfaceVisited );
+      Assert.assertTrue( rule.switchVisited );
+      Assert.assertTrue( rule.whileVisited );
+   }
+
+   private void processFile( final AllRule rule,
+                             final String fileName ) throws PMDException
+   {
+      final IFlexFile duane = getTestFiles().get( fileName );
+      rule.processFile( duane,
+                        NodeFactory.createPackage( FileSetUtils.buildAst( duane ) ),
+                        getTestFiles() );
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/ViolationPriorityTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/ViolationPriorityTest.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/ViolationPriorityTest.java
new file mode 100644
index 0000000..a3da264
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/ViolationPriorityTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.pmd.rules.core;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class ViolationPriorityTest
+{
+   @Test
+   public void testToString()
+   {
+      assertEquals( "1",
+                    ViolationPriority.HIGH.toString() );
+      assertEquals( "3",
+                    ViolationPriority.NORMAL.toString() );
+      assertEquals( "5",
+                    ViolationPriority.LOW.toString() );
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/ViolationTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/ViolationTest.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/ViolationTest.java
new file mode 100644
index 0000000..1ab9e78
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/ViolationTest.java
@@ -0,0 +1,236 @@
+/*
+ * 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.pmd.rules.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import java.io.FileNotFoundException;
+import java.net.URISyntaxException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.adobe.ac.pmd.FlexPmdTestBase;
+import com.adobe.ac.pmd.files.IFlexFile;
+import com.adobe.ac.pmd.rules.core.thresholded.IThresholdedRule;
+
+public class ViolationTest extends FlexPmdTestBase
+{
+   private static final int              BEGINNING_COLUMN = 0;
+   private static final int              BEGINNING_LINE   = 1;
+   private static final int              ENDING_COLUMN    = 20;
+   private static final int              ENDING_LINE      = 10;
+   private static final IThresholdedRule INFO_RULE        = new EmptyRule();
+   private static final String           RULE_SET_NAME    = "RuleSetName";
+   private static final IFlexRule        WARNING_RULE     = new WarningRule();
+   private IFlexFile                     abstractRowData;
+   private IFlexFile                     abstractRowDataWithPackage;
+   private IFlexFile                     iterationsListMxml;
+   private final ViolationPosition       position;
+
+   public ViolationTest()
+   {
+      super();
+
+      position = ViolationPosition.create( 10,
+                                           20,
+                                           30,
+                                           30 );
+   }
+
+   @Before
+   public void setUp()
+   {
+      abstractRowData = getTestFiles().get( "AbstractRowData.as" );
+      abstractRowDataWithPackage = getTestFiles().get( "com.adobe.ac.AbstractRowData.as" );
+      iterationsListMxml = getTestFiles().get( "com.adobe.ac.ncss.mxml.IterationsList.mxml" );
+   }
+
+   @Test
+   public void testCompareTo()
+   {
+      final Violation infoViolation = new Violation( position, INFO_RULE, null );
+      final Violation infoViolation2 = new Violation( ViolationPosition.create( 11,
+                                                                                20,
+                                                                                30,
+                                                                                30 ), INFO_RULE, null );
+      final Violation warningViolation = new Violation( position, WARNING_RULE, null );
+      final Violation warningViolation2 = new Violation( position, WARNING_RULE, null );
+
+      assertEquals( -1,
+                    infoViolation.compareTo( infoViolation2 ) );
+      assertEquals( -1,
+                    warningViolation.compareTo( infoViolation ) );
+      assertEquals( 0,
+                    warningViolation.compareTo( warningViolation2 ) );
+      assertEquals( 1,
+                    infoViolation2.compareTo( infoViolation ) );
+      assertEquals( 1,
+                    infoViolation.compareTo( warningViolation ) );
+   }
+
+   @Test
+   public void testGetActualValueForTheCurrentViolation()
+   {
+      final IThresholdedRule thresholdRule = ( IThresholdedRule ) new Violation( position, INFO_RULE, null ).getRule();
+
+      assertEquals( 0,
+                    thresholdRule.getActualValueForTheCurrentViolation() );
+   }
+
+   @Test
+   public void testGetClassName()
+   {
+      assertEquals( "",
+                    new Violation( position, INFO_RULE, null ).getClassName() );
+   }
+
+   @Test
+   public void testGetDefaultThreshold()
+   {
+      assertEquals( Integer.valueOf( ViolationPriority.LOW.toString() ),
+                    Integer.valueOf( new Violation( position, INFO_RULE, null ).getRule().getPriority() ) );
+   }
+
+   @Test
+   public void testGetDescription()
+   {
+      assertEquals( "emptyMessage",
+                    new Violation( position, INFO_RULE, null ).getDescription() );
+   }
+
+   @Test
+   public void testGetEndColumn()
+   {
+      assertEquals( 30,
+                    new Violation( position, INFO_RULE, null ).getEndColumn() );
+   }
+
+   @Test
+   public void testGetFileName()
+   {
+      final Violation infoViolation = new Violation( position, INFO_RULE, abstractRowData );
+
+      assertEquals( "AbstractRowData.as",
+                    infoViolation.getFilename() );
+
+      final Violation infoViolation2 = new Violation( position, INFO_RULE, abstractRowDataWithPackage );
+
+      assertEquals( "com.adobe.ac.AbstractRowData.as",
+                    infoViolation2.getFilename() );
+   }
+
+   @Test
+   public void testGetMethodName()
+   {
+      assertEquals( "",
+                    new Violation( position, INFO_RULE, abstractRowData ).getMethodName() );
+
+   }
+
+   @Test
+   public void testGetPackageName()
+   {
+      assertEquals( "",
+                    new Violation( position, INFO_RULE, abstractRowData ).getPackageName() );
+
+      assertEquals( "com.adobe.ac",
+                    new Violation( position, INFO_RULE, abstractRowDataWithPackage ).getPackageName() );
+   }
+
+   @Test
+   public void testGetRuleMessage()
+   {
+      assertEquals( "emptyMessage",
+                    new Violation( position, INFO_RULE, null ).getRuleMessage() );
+
+      assertEquals( "warning message",
+                    new Violation( position, WARNING_RULE, null ).getRuleMessage() );
+   }
+
+   @Test
+   public void testGetVariableName()
+   {
+      assertEquals( "",
+                    new Violation( position, INFO_RULE, null ).getVariableName() );
+   }
+
+   @Test
+   public void testIsSuppressed()
+   {
+      assertFalse( "",
+                   new Violation( position, INFO_RULE, abstractRowData ).isSuppressed() );
+   }
+
+   @Test
+   public void testToXmlString() throws FileNotFoundException,
+                                URISyntaxException
+   {
+      final Violation infoViolation = new Violation( ViolationPosition.create( BEGINNING_LINE,
+                                                                               ENDING_LINE,
+                                                                               BEGINNING_COLUMN,
+                                                                               ENDING_COLUMN ),
+                                                     INFO_RULE,
+                                                     null );
+
+      assertEquals( "As3 file at a root level",
+                    "      <violation beginline=\""
+                          + BEGINNING_LINE + "\" endline=\"" + ENDING_LINE + "\" begincolumn=\""
+                          + BEGINNING_COLUMN + "\" endcolumn=\"" + ENDING_COLUMN + "\" rule=\""
+                          + INFO_RULE.getRuleName() + "\" ruleset=\"" + RULE_SET_NAME + "\" package=\""
+                          + abstractRowData.getPackageName() + "\" class=\"" + abstractRowData.getClassName()
+                          + "\" externalInfoUrl=\"" + Violation.RULESET_CREATOR_URL + "EmptyRule\" "
+                          + "priority=\"" + INFO_RULE.getPriority() + "\">" + "emptyMessage" + "</violation>"
+                          + infoViolation.getNewLine(),
+                    infoViolation.toXmlString( abstractRowData,
+                                               RULE_SET_NAME ) );
+
+      final Violation warningViolation = new Violation( ViolationPosition.create( BEGINNING_LINE,
+                                                                                  ENDING_LINE,
+                                                                                  BEGINNING_COLUMN,
+                                                                                  ENDING_COLUMN ),
+                                                        WARNING_RULE,
+                                                        null );
+
+      assertEquals( "As3 File at a not-root level",
+                    "      <violation beginline=\""
+                          + BEGINNING_LINE + "\" endline=\"" + ENDING_LINE + "\" begincolumn=\""
+                          + BEGINNING_COLUMN + "\" endcolumn=\"" + ENDING_COLUMN + "\" rule=\""
+                          + WARNING_RULE.getRuleName() + "\" ruleset=\"" + RULE_SET_NAME + "\" package=\""
+                          + abstractRowDataWithPackage.getPackageName() + "\" class=\""
+                          + abstractRowData.getClassName() + "\" externalInfoUrl=\""
+                          + Violation.RULESET_CREATOR_URL + "WarningRule\" " + "priority=\""
+                          + WARNING_RULE.getPriority() + "\">" + "warning message" + "</violation>"
+                          + warningViolation.getNewLine(),
+                    warningViolation.toXmlString( abstractRowDataWithPackage,
+                                                  RULE_SET_NAME ) );
+
+      assertEquals( "Mxml File at a not-root level",
+                    "      <violation beginline=\""
+                          + BEGINNING_LINE + "\" endline=\"" + ENDING_LINE + "\" begincolumn=\""
+                          + BEGINNING_COLUMN + "\" endcolumn=\"" + ENDING_COLUMN + "\" rule=\""
+                          + WARNING_RULE.getRuleName() + "\" ruleset=\"" + RULE_SET_NAME + "\" package=\""
+                          + iterationsListMxml.getPackageName() + "\" class=\""
+                          + iterationsListMxml.getClassName() + "\" externalInfoUrl=\""
+                          + Violation.RULESET_CREATOR_URL + "WarningRule\" " + "priority=\""
+                          + WARNING_RULE.getPriority() + "\">" + "warning message" + "</violation>"
+                          + warningViolation.getNewLine(),
+                    warningViolation.toXmlString( iterationsListMxml,
+                                                  RULE_SET_NAME ) );
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/WarningRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/WarningRule.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/WarningRule.java
new file mode 100644
index 0000000..3898c7e
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/test/java/com/adobe/ac/pmd/rules/core/WarningRule.java
@@ -0,0 +1,57 @@
+/*
+ * 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.pmd.rules.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.adobe.ac.pmd.IFlexViolation;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+public class WarningRule extends AbstractFlexRule
+{
+   @Override
+   public String getMessage()
+   {
+      return "warning message.";
+   }
+
+   @Override
+   public final boolean isConcernedByTheCurrentFile()
+   {
+      return true;
+   }
+
+   @Override
+   protected ViolationPriority getDefaultPriority()
+   {
+      return ViolationPriority.NORMAL;
+   }
+
+   @Override
+   protected List< IFlexViolation > findViolationsInCurrentFile()
+   {
+      final ArrayList< IFlexViolation > violations = new ArrayList< IFlexViolation >();
+
+      addViolation( violations,
+                    new ViolationPosition( 0 ) );
+
+      return violations;
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/.externalToolBuilders/net.sourceforge.pmd.eclipse.plugin.pmdBuilder.launch
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/.externalToolBuilders/net.sourceforge.pmd.eclipse.plugin.pmdBuilder.launch b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/.externalToolBuilders/net.sourceforge.pmd.eclipse.plugin.pmdBuilder.launch
new file mode 100644
index 0000000..725ec3c
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/.externalToolBuilders/net.sourceforge.pmd.eclipse.plugin.pmdBuilder.launch
@@ -0,0 +1,25 @@
+<!--
+
+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.
+
+-->
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="net.sourceforge.pmd.eclipse.plugin.pmdBuilder"/>
+<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+</launchConfiguration>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/.pmd
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/.pmd b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/.pmd
new file mode 100644
index 0000000..5bebc12
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/.pmd
@@ -0,0 +1,935 @@
+<!--
+
+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.
+
+-->
+<?xml version="1.0" encoding="UTF-8"?>
+<pmd>
+    <useProjectRuleSet>false</useProjectRuleSet>
+    <ruleSetFile>.ruleset</ruleSetFile>
+    <rules>
+        <rule>
+            <name>AvoidDecimalLiteralsInBigDecimalConstructor</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidMultipleUnaryOperators</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidThreadGroup</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingHardCodedIP</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingOctalValues</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BigIntegerInstantiation</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BooleanInstantiation</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BrokenNullCheck</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CheckResultSet</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ClassCastExceptionWithToArray</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CollapsibleIfStatements</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoubleCheckedLocking</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyCatchBlock</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyFinallyBlock</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyIfStmt</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyStatementNotInLoop</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyStaticInitializer</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptySwitchStatements</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptySynchronizedBlock</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyTryBlock</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyWhileStmt</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ForLoopShouldBeWhileLoop</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JumbledIncrementer</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MisplacedNullCheck</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>OverrideBothEqualsAndHashcode</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ReturnFromFinallyBlock</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnconditionalIfStatement</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryConversionTemporary</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryFinalModifier</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryReturn</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedNullCheckInEquals</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UselessOperationOnImmutable</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UselessOverridingMethod</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ForLoopsMustUseBraces</name>
+            <ruleset>Braces Rules</ruleset>
+        </rule>
+        <rule>
+            <name>IfElseStmtsMustUseBraces</name>
+            <ruleset>Braces Rules</ruleset>
+        </rule>
+        <rule>
+            <name>IfStmtsMustUseBraces</name>
+            <ruleset>Braces Rules</ruleset>
+        </rule>
+        <rule>
+            <name>WhileLoopsMustUseBraces</name>
+            <ruleset>Braces Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CloneThrowsCloneNotSupportedException</name>
+            <ruleset>Clone Implementation Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ProperCloneImplementation</name>
+            <ruleset>Clone Implementation Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CyclomaticComplexity</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveClassLength</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveMethodLength</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveParameterList</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessivePublicCount</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NcssConstructorCount</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NcssMethodCount</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NcssTypeCount</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NPathComplexity</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>TooManyFields</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>TooManyMethods</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AssignmentInOperand</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AtLeastOneConstructor</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidAccessibilityAlteration</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingNativeCode</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingShortType</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingVolatile</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BooleanInversion</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CallSuperInConstructor</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DataflowAnomalyAnalysis</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DefaultPackage</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotCallGarbageCollectionExplicitly</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DontImportSun</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NullAssignment</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>OnlyOneReturn</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousOctalEscape</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryConstructor</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryParentheses</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedModifier</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CouplingBetweenObjects</name>
+            <ruleset>Coupling Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveImports</name>
+            <ruleset>Coupling Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AbstractClassWithoutAbstractMethod</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AbstractClassWithoutAnyMethod</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AccessorClassGeneration</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AssignmentToNonFinalStatic</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidConstantsInterface</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidDeeplyNestedIfStmts</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidInstanceofChecksInCatchClause</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidProtectedFieldInFinalClass</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidReassigningParameters</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidSynchronizedAtMethodLevel</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BadComparison</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ClassWithOnlyPrivateConstructorsShouldBeFinal</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CloseResource</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CompareObjectsWithEquals</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ConfusingTernary</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ConstructorCallsOverridableMethod</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DefaultLabelNotLastInSwitchStmt</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EqualsNull</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>FinalFieldCouldBeStatic</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>IdempotentOperations</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ImmutableField</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>InstantiationToGetClass</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MissingBreakInSwitch</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MissingStaticMethodInNonInstantiatableClass</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NonCaseLabelInSwitchStatement</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NonStaticInitializer</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NonThreadSafeSingleton</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>OptimizableToArrayCall</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>PositionLiteralsFirstInComparisons</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>PreserveStackTrace</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ReturnEmptyArrayRatherThanNull</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimpleDateFormatNeedsLocale</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyBooleanExpressions</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyBooleanReturns</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyConditional</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SingularField</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SwitchDensity</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SwitchStmtsShouldHaveDefault</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>TooFewBranchesForASwitchStatement</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UncommentedEmptyConstructor</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UncommentedEmptyMethod</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryLocalBeforeReturn</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnsynchronizedStaticDateFormatter</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseCollectionIsEmpty</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseLocaleWithCaseConversions</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseNotifyAllInsteadOfNotify</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseSingleton</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidCallingFinalize</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyFinalizer</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeDoesNotCallSuperFinalize</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeOnlyCallsSuperFinalize</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeOverloaded</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeShouldBeProtected</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DontImportJavaLang</name>
+            <ruleset>Import Statement Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DuplicateImports</name>
+            <ruleset>Import Statement Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ImportFromSamePackage</name>
+            <ruleset>Import Statement Rules</ruleset>
+        </rule>
+        <rule>
+            <name>TooManyStaticImports</name>
+            <ruleset>Import Statement Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotCallSystemExit</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotUseThreads</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LocalHomeNamingConvention</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LocalInterfaceSessionNamingConvention</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MDBAndSessionBeanNamingConvention</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>RemoteInterfaceNamingConvention</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>RemoteSessionInterfaceNamingConvention</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>StaticEJBFieldShouldBeFinal</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseProperClassLoader</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ProperLogger</name>
+            <ruleset>Jakarta Commons Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseCorrectExceptionLogging</name>
+            <ruleset>Jakarta Commons Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidPrintStackTrace</name>
+            <ruleset>Java Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LoggerIsNotStaticFinal</name>
+            <ruleset>Java Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MoreThanOneLogger</name>
+            <ruleset>Java Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SystemPrintln</name>
+            <ruleset>Java Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MissingSerialVersionUID</name>
+            <ruleset>JavaBean Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnitAssertionsShouldIncludeMessage</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnitSpelling</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnitStaticSuite</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnitTestsShouldIncludeAssert</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyBooleanAssertion</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>TestClassWithoutTestCases</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryBooleanAssertion</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseAssertEqualsInsteadOfAssertTrue</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseAssertNullInsteadOfAssertTrue</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseAssertSameInsteadOfAssertTrue</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidAssertAsIdentifier</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidEnumAsIdentifier</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ByteInstantiation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>IntegerInstantiation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnit4SuitesShouldUseSuiteAnnotation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnit4TestShouldUseAfterAnnotation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnit4TestShouldUseBeforeAnnotation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnit4TestShouldUseTestAnnotation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnitUseExpected</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LongInstantiation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ReplaceEnumerationWithIterator</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ReplaceHashtableWithMap</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ReplaceVectorWithList</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ShortInstantiation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AbstractNaming</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidDollarSigns</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidFieldNameMatchingMethodName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidFieldNameMatchingTypeName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BooleanGetMethodName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ClassNamingConventions</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MethodNamingConventions</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MethodWithSameNameAsEnclosingClass</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MisleadingVariableName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NoPackage</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>PackageCase</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ShortMethodName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ShortVariable</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousConstantFieldName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousEqualsMethodName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousHashcodeMethodName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>VariableNamingConventions</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AddEmptyString</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidArrayLoops</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidInstantiatingObjectsInLoops</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LocalVariableCouldBeFinal</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MethodArgumentCouldBeFinal</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyStartsWith</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryWrapperObjectCreation</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseArrayListInsteadOfVector</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseArraysAsList</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseStringBufferForStringAppends</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ArrayIsStoredDirectly</name>
+            <ruleset>Security Code Guidelines</ruleset>
+        </rule>
+        <rule>
+            <name>MethodReturnsInternalArray</name>
+            <ruleset>Security Code Guidelines</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidCatchingNPE</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidCatchingThrowable</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidRethrowingException</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidThrowingNullPointerException</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidThrowingRawExceptionTypes</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotExtendJavaLangError</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotThrowExceptionInFinally</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExceptionAsFlowControl</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AppendCharacterWithChar</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidDuplicateLiterals</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidStringBufferField</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ConsecutiveLiteralAppends</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>InefficientEmptyStringCheck</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>InefficientStringBuffering</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>InsufficientStringBufferDeclaration</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>StringBufferInstantiationWithChar</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>StringInstantiation</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>StringToString</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryCaseChange</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseEqualsToCompareStrings</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseIndexOfChar</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UselessStringValueOf</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseStringBufferLength</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CloneMethodMustImplementCloneable</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LooseCoupling</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SignatureDeclareThrowsException</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedImports</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedFormalParameter</name>
+            <ruleset>Unused Code Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedLocalVariable</name>
+            <ruleset>Unused Code Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedPrivateField</name>
+            <ruleset>Unused Code Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedPrivateMethod</name>
+            <ruleset>Unused Code Rules</ruleset>
+        </rule>
+    </rules>
+    <includeDerivedFiles>false</includeDerivedFiles>
+    <violationsAsErrors>true</violationsAsErrors>
+</pmd>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/pom.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/pom.xml b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/pom.xml
new file mode 100644
index 0000000..960c505
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/pom.xml
@@ -0,0 +1,83 @@
+<!--
+
+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>
+
+    <parent>
+        <groupId>org.apache.flex.pmd</groupId>
+        <artifactId>flex-pmd-java</artifactId>
+        <version>1.3-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>flex-pmd-ruleset</artifactId>
+    <packaging>jar</packaging>
+
+    <name>Adobe Flex PMD RuleSet</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>${dom4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.parent.groupId}</groupId>
+            <artifactId>${project.artifactId}-api</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>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/MonkeyPatchingRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/MonkeyPatchingRule.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/MonkeyPatchingRule.java
new file mode 100644
index 0000000..fb24575
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/MonkeyPatchingRule.java
@@ -0,0 +1,72 @@
+/*
+ * 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.pmd.rules.architecture;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.adobe.ac.pmd.IFlexViolation;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class MonkeyPatchingRule extends AbstractFlexRule
+{
+   /*
+    * (non-Javadoc)
+    * @see
+    * com.adobe.ac.pmd.rules.core.AbstractFlexRule#findViolationsInCurrentFile()
+    */
+   @Override
+   protected final List< IFlexViolation > findViolationsInCurrentFile()
+   {
+      final List< IFlexViolation > violations = new ArrayList< IFlexViolation >();
+
+      if ( getCurrentFile().getPackageName().startsWith( "mx." )
+            && !getCurrentFile().getClassName().equals( "Version.as" )
+            && !getCurrentFile().getClassName().endsWith( "Style.as" ) )
+      {
+         addViolation( violations,
+                       new ViolationPosition( 0 ) );
+      }
+      return violations;
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+    */
+   @Override
+   protected final ViolationPriority getDefaultPriority()
+   {
+      return ViolationPriority.HIGH;
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see
+    * com.adobe.ac.pmd.rules.core.AbstractFlexRule#isConcernedByTheCurrentFile()
+    */
+   @Override
+   protected final boolean isConcernedByTheCurrentFile()
+   {
+      return !getCurrentFile().isMxml();
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/UseInternalClassOutsideApiClass.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/UseInternalClassOutsideApiClass.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/UseInternalClassOutsideApiClass.java
new file mode 100644
index 0000000..ccda5a6
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/UseInternalClassOutsideApiClass.java
@@ -0,0 +1,126 @@
+/*
+ * 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.pmd.rules.architecture;
+
+import org.apache.commons.lang.StringUtils;
+
+import com.adobe.ac.pmd.nodes.IPackage;
+import com.adobe.ac.pmd.parser.IParserNode;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class UseInternalClassOutsideApiClass extends AbstractAstFlexRule
+{
+   private static final String API_PACKAGE_NAME      = "api";
+   private static final String INTERNAL_PACKAGE_NAME = "restricted";
+   private static final String PACKAGE_SEPARATOR     = ".";
+
+   /*
+    * (non-Javadoc)
+    * @see
+    * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+    * .ac.pmd.nodes.IPackage)
+    */
+   @Override
+   protected final void findViolations( final IPackage packageNode )
+   {
+      final String packageName = packageNode.getName();
+      final boolean isApiClass = isApiClass( packageName );
+      final boolean isInternalClass = isInternalClass( packageName );
+      String functionAreaName = null;
+
+      if ( isApiClass
+            || isInternalClass )
+      {
+         functionAreaName = extractFunctionalArea( packageName,
+                                                   false );
+      }
+      for ( final IParserNode importNode : packageNode.getImports() )
+      {
+         final String importName = importNode.getStringValue();
+         final String importFunctionalArea = extractFunctionalArea( importName,
+                                                                    true );
+
+         if ( doesLineContainPackageReference( importName,
+                                               INTERNAL_PACKAGE_NAME )
+               && ( functionAreaName == null || !functionAreaName.equals( importFunctionalArea ) ) )
+         {
+            addViolation( importNode,
+                          importName,
+                          importFunctionalArea );
+         }
+      }
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+    */
+   @Override
+   protected final ViolationPriority getDefaultPriority()
+   {
+      return ViolationPriority.HIGH;
+   }
+
+   private boolean doesLineContainPackageReference( final String line,
+                                                    final String packageName )
+   {
+      return line.contains( PACKAGE_SEPARATOR
+            + packageName );
+   }
+
+   private String extractFunctionalArea( final String packageName,
+                                         final boolean isInImport )
+   {
+      if ( packageName.contains( INTERNAL_PACKAGE_NAME ) )
+      {
+         return extractFunctionArea( packageName,
+                                     INTERNAL_PACKAGE_NAME,
+                                     isInImport );
+      }
+      return extractFunctionArea( packageName,
+                                  API_PACKAGE_NAME,
+                                  isInImport );
+   }
+
+   private String extractFunctionArea( final String packageName,
+                                       final String visibilityPackageName,
+                                       final boolean isInImport )
+   {
+      return StringUtils.substringAfterLast( StringUtils.substringBeforeLast( packageName,
+                                                                              PACKAGE_SEPARATOR
+                                                                                    + visibilityPackageName
+                                                                                    + ( isInImport ? PACKAGE_SEPARATOR
+                                                                                                  : "" ) ),
+                                             PACKAGE_SEPARATOR );
+   }
+
+   private boolean isApiClass( final String packageName )
+   {
+      return doesLineContainPackageReference( packageName,
+                                              API_PACKAGE_NAME );
+   }
+
+   private boolean isInternalClass( final String packageName )
+   {
+      return doesLineContainPackageReference( packageName,
+                                              INTERNAL_PACKAGE_NAME );
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/ViewComponentReferencedInModelRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/ViewComponentReferencedInModelRule.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/ViewComponentReferencedInModelRule.java
new file mode 100644
index 0000000..ec5a40f
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/architecture/ViewComponentReferencedInModelRule.java
@@ -0,0 +1,87 @@
+/*
+ * 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.pmd.rules.architecture;
+
+import java.util.Locale;
+import java.util.regex.Matcher;
+
+import com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class ViewComponentReferencedInModelRule extends AbstractRegexpBasedRule // NO_UCD
+{
+   private static final String ALERT_CLASS_NAME           = "Alert";
+   private static final String FLEX_CONTROLS_PACKAGE_NAME = "mx.controls";
+   private static final String MODEL_CLASS_SUFFIX         = "model";
+   private static final String MODEL_PACKAGE_NAME         = ".model";
+   private static final String VIEW_PACKAGE_NAME          = ".view";
+
+   /*
+    * (non-Javadoc)
+    * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+    */
+   @Override
+   protected final ViolationPriority getDefaultPriority()
+   {
+      return ViolationPriority.NORMAL;
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#getRegexp()
+    */
+   @Override
+   protected final String getRegexp()
+   {
+      return ".*import (.*);?.*";
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see
+    * com.adobe.ac.pmd.rules.core.AbstractFlexRule#isConcernedByTheCurrentFile()
+    */
+   @Override
+   protected final boolean isConcernedByTheCurrentFile()
+   {
+      return !getCurrentFile().isMxml()
+            && getCurrentFile().getFullyQualifiedName()
+                               .toLowerCase( Locale.ENGLISH )
+                               .contains( MODEL_CLASS_SUFFIX );
+   }
+
+   /*
+    * (non-Javadoc)
+    * @seecom.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#
+    * isViolationDetectedOnThisMatchingLine(java.lang.String)
+    */
+   @Override
+   protected final boolean isViolationDetectedOnThisMatchingLine( final String line )
+   {
+      final Matcher matcher = getMatcher( line );
+
+      matcher.matches();
+      final String importedClass = matcher.group( 1 );
+
+      return importedClass.contains( FLEX_CONTROLS_PACKAGE_NAME )
+            && !importedClass.contains( ALERT_CLASS_NAME ) || importedClass.contains( VIEW_PACKAGE_NAME )
+            && !importedClass.contains( MODEL_PACKAGE_NAME );
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/AbstractAsDocRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/AbstractAsDocRule.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/AbstractAsDocRule.java
new file mode 100644
index 0000000..d0d8864
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/AbstractAsDocRule.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.pmd.rules.asdocs;
+
+import com.adobe.ac.pmd.nodes.IAsDocHolder;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+
+/**
+ * @author xagnetti
+ */
+abstract class AbstractAsDocRule extends AbstractAstFlexRule
+{
+   /**
+    * @param asDocHolder
+    */
+   protected void addViolationIfAsDocMissing( final IAsDocHolder asDocHolder )
+   {
+      if ( asDocHolder.getAsDoc() == null )
+      {
+         addViolation( asDocHolder );
+      }
+   }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/AttributeAsDocMissingRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/AttributeAsDocMissingRule.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/AttributeAsDocMissingRule.java
new file mode 100644
index 0000000..b2d23f9
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/AttributeAsDocMissingRule.java
@@ -0,0 +1,53 @@
+/*
+ * 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.pmd.rules.asdocs;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.nodes.IAttribute;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class AttributeAsDocMissingRule extends AbstractAsDocRule
+{
+   /*
+    * (non-Javadoc)
+    * @see
+    * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolationsFromAttributes
+    * (java.util.List)
+    */
+   @Override
+   protected void findViolationsFromAttributes( final List< IAttribute > variables )
+   {
+      for ( final IAttribute attribute : variables )
+      {
+         addViolationIfAsDocMissing( attribute );
+      }
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+    */
+   @Override
+   protected ViolationPriority getDefaultPriority()
+   {
+      return ViolationPriority.NORMAL;
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/ClassAsDocMissingRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/ClassAsDocMissingRule.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/ClassAsDocMissingRule.java
new file mode 100644
index 0000000..a1b0431
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/ClassAsDocMissingRule.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.pmd.rules.asdocs;
+
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class ClassAsDocMissingRule extends AbstractAsDocRule
+{
+   /*
+    * (non-Javadoc)
+    * @see
+    * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#isConcernedByTheCurrentFile
+    * ()
+    */
+   @Override
+   public boolean isConcernedByTheCurrentFile()
+   {
+      return !getCurrentFile().isMxml();
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see
+    * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+    * .ac.pmd.nodes.IClass)
+    */
+   @Override
+   protected void findViolations( final IClass classNode )
+   {
+      addViolationIfAsDocMissing( classNode );
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+    */
+   @Override
+   protected ViolationPriority getDefaultPriority()
+   {
+      return ViolationPriority.NORMAL;
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/MethodAsDocMissingRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/MethodAsDocMissingRule.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/MethodAsDocMissingRule.java
new file mode 100644
index 0000000..faf6056
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/asdocs/MethodAsDocMissingRule.java
@@ -0,0 +1,53 @@
+/*
+ * 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.pmd.rules.asdocs;
+
+import com.adobe.ac.pmd.nodes.IFunction;
+import com.adobe.ac.pmd.nodes.Modifier;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class MethodAsDocMissingRule extends AbstractAsDocRule
+{
+   /*
+    * (non-Javadoc)
+    * @see
+    * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+    * .ac.pmd.nodes.IFunction)
+    */
+   @Override
+   protected void findViolations( final IFunction function )
+   {
+      if ( ( function.isPublic() || function.is( Modifier.PROTECTED ) )
+            && !function.isGetter() && !function.isSetter() && function.getAsDoc() == null )
+      {
+         addViolation( function );
+      }
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+    */
+   @Override
+   protected ViolationPriority getDefaultPriority()
+   {
+      return ViolationPriority.NORMAL;
+   }
+}


Mime
View raw message