flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cd...@apache.org
Subject [14/24] git commit: [flex-utilities] [refs/heads/feature/pmd-5.2-language-module] - Initial commit of the PMD language module for Apache Flex
Date Sat, 07 Mar 2015 12:07:07 GMT
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/NonStaticConstantFieldRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/NonStaticConstantFieldRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/NonStaticConstantFieldRule.java
new file mode 100644
index 0000000..1686b96
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/NonStaticConstantFieldRule.java
@@ -0,0 +1,54 @@
+/*
+ * 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 org.apache.flex.pmd.rules.maintanability;
+
+import org.apache.flex.pmd.nodes.IConstant;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+public class NonStaticConstantFieldRule extends AbstractAstFlexRule {
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolationsFromConstants
+     * (java.util.List)
+     */
+    @Override
+    protected final void findViolationsFromConstants(final List<IConstant> constants) {
+        for (final IConstant field : constants) {
+            if (!field.isStatic()
+                    && field.isPublic()) {
+                addViolation(field,
+                        field.getName());
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.LOW;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/OnlyOneReturnRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/OnlyOneReturnRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/OnlyOneReturnRule.java
new file mode 100644
index 0000000..15391e0
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/OnlyOneReturnRule.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.flex.pmd.rules.maintanability;
+
+import org.apache.flex.pmd.parser.IParserNode;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class OnlyOneReturnRule extends AbstractAstFlexRule {
+    private int returnStatement;
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.NORMAL;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#visitFunction(com.adobe
+     * .ac.pmd.parser.IParserNode,
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule.FunctionType)
+     */
+    @Override
+    protected void visitFunction(final IParserNode functionNode,
+                                 final FunctionType type) {
+        returnStatement = 0;
+        super.visitFunction(functionNode,
+                type);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#visitReturn(com.adobe.
+     * ac.pmd.parser.IParserNode)
+     */
+    @Override
+    protected void visitReturn(final IParserNode ast) {
+        returnStatement++;
+
+        if (returnStatement > 1) {
+            addViolation(ast);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/ProtectedStaticMethodRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/ProtectedStaticMethodRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/ProtectedStaticMethodRule.java
new file mode 100644
index 0000000..2704549
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/ProtectedStaticMethodRule.java
@@ -0,0 +1,50 @@
+/*
+ * 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 org.apache.flex.pmd.rules.maintanability;
+
+import org.apache.flex.pmd.nodes.IFunction;
+import org.apache.flex.pmd.nodes.Modifier;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class ProtectedStaticMethodRule extends AbstractAstFlexRule {
+    /*
+     * (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.is(Modifier.STATIC)
+                && function.is(Modifier.PROTECTED)) {
+            addViolation(function);
+        }
+    }
+
+    /*
+     * (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/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/ReferenceToVariableBindingFromItsInitializerRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/ReferenceToVariableBindingFromItsInitializerRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/ReferenceToVariableBindingFromItsInitializerRule.java
new file mode 100644
index 0000000..0a25d33
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/ReferenceToVariableBindingFromItsInitializerRule.java
@@ -0,0 +1,82 @@
+/*
+ * 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 org.apache.flex.pmd.rules.maintanability;
+
+import org.apache.flex.pmd.nodes.IAttribute;
+import org.apache.flex.pmd.nodes.IConstant;
+import org.apache.flex.pmd.nodes.IField;
+import org.apache.flex.pmd.nodes.IFieldInitialization;
+import org.apache.flex.pmd.parser.IParserNode;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+public class ReferenceToVariableBindingFromItsInitializerRule extends AbstractAstFlexRule {
+    /*
+     * (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) {
+            findViolation(attribute);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolationsFromConstants
+     * (java.util.List)
+     */
+    @Override
+    protected void findViolationsFromConstants(final List<IConstant> constants) {
+        for (final IConstant constant : constants) {
+            findViolation(constant);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.HIGH;
+    }
+
+    private void findViolation(final IField attribute) {
+        final IFieldInitialization initialization = attribute.getInitializationExpression();
+        final String name = attribute.getName();
+
+        if (initialization != null) {
+            final List<IParserNode> statements = initialization.getInternalNode()
+                    .findPrimaryStatementsFromNameInChildren(new String[]
+                            {name});
+            if (statements != null
+                    && !statements.isEmpty()) {
+                addViolation(attribute);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/TrueFalseConditionRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/TrueFalseConditionRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/TrueFalseConditionRule.java
new file mode 100644
index 0000000..960db39
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/TrueFalseConditionRule.java
@@ -0,0 +1,75 @@
+/*
+ * 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 org.apache.flex.pmd.rules.maintanability;
+
+import org.apache.flex.pmd.parser.IParserNode;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class TrueFalseConditionRule extends AbstractAstFlexRule // NO_UCD
+{
+    private static final int FALSE = 2;
+    private static final int TRUE = 1;
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.HIGH;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#visitCondition(com.adobe
+     * .ac.pmd.parser.IParserNode)
+     */
+    @Override
+    protected void visitCondition(final IParserNode condition) {
+        super.visitCondition(condition);
+
+        final int conditionChidrenHaveBooleans = conditionChidrenHaveBooleans(condition);
+
+        if (conditionChidrenHaveBooleans > 0) {
+            addViolation(condition,
+                    (conditionChidrenHaveBooleans == TRUE ? ""
+                            : "!")
+                            + "condition");
+        }
+    }
+
+    private int conditionChidrenHaveBooleans(final IParserNode condition) {
+        if (condition != null) {
+            for (final IParserNode child : condition.getChildren()) {
+                if (child.getStringValue() != null) {
+                    if (child.getStringValue().compareTo("true") == 0) {
+                        return TRUE;
+                    }
+                    if (child.getStringValue().compareTo("false") == 0) {
+                        return FALSE;
+                    }
+                }
+            }
+        }
+        return 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/UselessOverridenFunctionRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/UselessOverridenFunctionRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/UselessOverridenFunctionRule.java
new file mode 100644
index 0000000..b3f524d
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/UselessOverridenFunctionRule.java
@@ -0,0 +1,73 @@
+/*
+ * 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 org.apache.flex.pmd.rules.maintanability;
+
+import org.apache.flex.pmd.nodes.IFunction;
+import org.apache.flex.pmd.parser.IParserNode;
+import org.apache.flex.pmd.parser.KeyWords;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+public class UselessOverridenFunctionRule extends AbstractAstFlexRule {
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+     * .ac.pmd.nodes.IFunction)
+     */
+    @Override
+    protected final void findViolations(final IFunction function) {
+        final int statementNbAtFirstLevelInBody = function.getStatementNbInBody();
+
+        if (function.getBody() != null
+                && function.isOverriden() && statementNbAtFirstLevelInBody == 1) {
+            final List<IParserNode> statements = function.findPrimaryStatementsInBody(KeyWords.SUPER.toString());
+
+            if (statements != null
+                    && statements.size() == 1 && function.getBody().getChild(0).getChild(1) != null
+                    && function.getBody().getChild(0).getChild(1).getChild(1) != null
+                    && !areArgumentsModified(function.getBody().getChild(0).getChild(1).getChild(1))) {
+                addViolation(function);
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.LOW;
+    }
+
+    private boolean areArgumentsModified(final IParserNode args) {
+        if (args.getChildren() != null) {
+            for (final IParserNode arg : args.getChildren()) {
+                if (arg.getChildren() != null) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/AbstractUseForbiddenTypeRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/AbstractUseForbiddenTypeRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/AbstractUseForbiddenTypeRule.java
new file mode 100644
index 0000000..9dcbfc2
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/AbstractUseForbiddenTypeRule.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 org.apache.flex.pmd.rules.maintanability.forbiddentypes;
+
+import org.apache.flex.pmd.nodes.IClass;
+import org.apache.flex.pmd.nodes.IFunction;
+import org.apache.flex.pmd.nodes.IVariable;
+import org.apache.flex.pmd.parser.IParserNode;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+
+import java.util.List;
+import java.util.Map.Entry;
+
+/**
+ * @author xagnetti
+ */
+public abstract class AbstractUseForbiddenTypeRule extends AbstractAstFlexRule {
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+     * .ac.pmd.nodes.IClass)
+     */
+    @Override
+    protected void findViolations(final IClass classNode) {
+        super.findViolations(classNode);
+
+        findViolationInVariableLists(classNode.getAttributes());
+        findViolationInVariableLists(classNode.getConstants());
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+     * .ac.pmd.nodes.IFunction)
+     */
+    @Override
+    protected void findViolations(final IFunction function) {
+        findViolationsInReturnType(function);
+        if (!function.isOverriden()) {
+            findViolationsInParametersList(function);
+        }
+        findViolationsInLocalVariables(function);
+    }
+
+    /**
+     * @param function
+     */
+    protected void findViolationsInParametersList(final IFunction function) {
+        findViolationInVariableLists(function.getParameters());
+    }
+
+    /**
+     * @return
+     */
+    protected abstract String getForbiddenType();
+
+    private <E extends IVariable> void findViolationInVariableLists(final List<E> variables) {
+        for (final IVariable variable : variables) {
+            if (variable.getType() != null) {
+                tryToAddViolation(variable.getInternalNode(),
+                        variable.getType().toString());
+            }
+        }
+    }
+
+    private void findViolationsInLocalVariables(final IFunction function) {
+        for (final Entry<String, IParserNode> localVariableEntry : function.getLocalVariables().entrySet()) {
+            final IParserNode type = getTypeFromFieldDeclaration(localVariableEntry.getValue());
+
+            tryToAddViolation(type,
+                    type.getStringValue());
+        }
+    }
+
+    private void findViolationsInReturnType(final IFunction function) {
+        if (function != null
+                && function.getReturnType() != null) {
+            tryToAddViolation(function.getReturnType().getInternalNode(),
+                    function.getReturnType().toString());
+        }
+    }
+
+    private void tryToAddViolation(final IParserNode node,
+                                   final String typeName) {
+        if (typeName.equals(getForbiddenType())) {
+            addViolation(node);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseDictionaryTypeRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseDictionaryTypeRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseDictionaryTypeRule.java
new file mode 100644
index 0000000..f491623
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseDictionaryTypeRule.java
@@ -0,0 +1,44 @@
+/*
+ * 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 org.apache.flex.pmd.rules.maintanability.forbiddentypes;
+
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class UseDictionaryTypeRule extends AbstractUseForbiddenTypeRule // NO_UCD
+{
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.HIGH;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @seecom.adobe.ac.pmd.rules.maintanability.forbiddentypes.
+     * AbstractUseForbiddenTypeRule#getForbiddenType()
+     */
+    @Override
+    protected String getForbiddenType() {
+        return "Dictionnary";
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseGenericTypeRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseGenericTypeRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseGenericTypeRule.java
new file mode 100644
index 0000000..dbb3f75
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseGenericTypeRule.java
@@ -0,0 +1,46 @@
+/*
+ * 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 org.apache.flex.pmd.rules.maintanability.forbiddentypes;
+
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class UseGenericTypeRule extends AbstractUseForbiddenTypeRule // NO_UCD
+{
+    private static final String STAR = "*";
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.HIGH;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @seecom.adobe.ac.pmd.rules.maintanability.forbiddentypes.
+     * AbstractUseForbiddenTypeRule#getForbiddenType()
+     */
+    @Override
+    protected String getForbiddenType() {
+        return STAR;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseObjectTypeRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseObjectTypeRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseObjectTypeRule.java
new file mode 100644
index 0000000..f095ef9
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/maintanability/forbiddentypes/UseObjectTypeRule.java
@@ -0,0 +1,84 @@
+/*
+ * 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 org.apache.flex.pmd.rules.maintanability.forbiddentypes;
+
+import org.apache.flex.pmd.nodes.IClass;
+import org.apache.flex.pmd.nodes.IFunction;
+import org.apache.flex.pmd.parser.IParserNode;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class UseObjectTypeRule extends AbstractUseForbiddenTypeRule // NO_UCD
+{
+    private boolean isResponder;
+
+    /*
+     * (non-Javadoc)
+     * @seecom.adobe.ac.pmd.rules.maintanability.forbiddentypes.
+     * AbstractUseForbiddenTypeRule#findViolations(com.adobe.ac.pmd.nodes.IClass)
+     */
+    @Override
+    protected void findViolations(final IClass classNode) {
+        for (final IParserNode implementation : classNode.getImplementations()) {
+            if ("IResponder".equals(implementation.getStringValue())) {
+                isResponder = true;
+                break;
+            }
+        }
+
+        super.findViolations(classNode);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @seecom.adobe.ac.pmd.rules.maintanability.forbiddentypes.
+     * AbstractUseForbiddenTypeRule
+     * #findViolationsInParametersList(com.adobe.ac.pmd.nodes.IFunction)
+     */
+    @Override
+    protected void findViolationsInParametersList(final IFunction function) {
+        if (!isResponderImplementation(function)) {
+            super.findViolationsInParametersList(function);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.HIGH;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @seecom.adobe.ac.pmd.rules.maintanability.forbiddentypes.
+     * AbstractUseForbiddenTypeRule#getForbiddenType()
+     */
+    @Override
+    protected String getForbiddenType() {
+        return "Object";
+    }
+
+    private boolean isResponderImplementation(final IFunction function) {
+        return isResponder
+                && (function.getName().equals("result") || function.getName().equals("fault"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/multitouch/AvoidRollMouseEventRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/multitouch/AvoidRollMouseEventRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/multitouch/AvoidRollMouseEventRule.java
new file mode 100644
index 0000000..b1062b4
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/multitouch/AvoidRollMouseEventRule.java
@@ -0,0 +1,64 @@
+/*
+ * 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 org.apache.flex.pmd.rules.multitouch;
+
+import org.apache.flex.pmd.rules.core.AbstractRegexpBasedRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class AvoidRollMouseEventRule extends AbstractRegexpBasedRule {
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.HIGH;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#getRegexp()
+     */
+    @Override
+    protected String getRegexp() {
+        return ".*((mouseOut)|(MOUSE_OUT)|(mouseOver)|(MOUSE_OVER)|"
+                + "(rollOut)|(ROLL_OUT)|(rollOver)|(ROLL_OVER)).*";
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractFlexRule#isConcernedByTheCurrentFile()
+     */
+    @Override
+    protected boolean isConcernedByTheCurrentFile() {
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @seecom.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#
+     * isViolationDetectedOnThisMatchingLine(java.lang.String)
+     */
+    @Override
+    protected boolean isViolationDetectedOnThisMatchingLine(final String line) {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/multitouch/AvoidTooltipRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/multitouch/AvoidTooltipRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/multitouch/AvoidTooltipRule.java
new file mode 100644
index 0000000..baf0314
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/multitouch/AvoidTooltipRule.java
@@ -0,0 +1,63 @@
+/*
+ * 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 org.apache.flex.pmd.rules.multitouch;
+
+import org.apache.flex.pmd.rules.core.AbstractRegexpBasedRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class AvoidTooltipRule extends AbstractRegexpBasedRule {
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.HIGH;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#getRegexp()
+     */
+    @Override
+    protected String getRegexp() {
+        return ".*\\s*toolTip\\s*=.*";
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractFlexRule#isConcernedByTheCurrentFile()
+     */
+    @Override
+    protected boolean isConcernedByTheCurrentFile() {
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @seecom.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#
+     * isViolationDetectedOnThisMatchingLine(java.lang.String)
+     */
+    @Override
+    protected boolean isViolationDetectedOnThisMatchingLine(final String line) {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/AbstractMoreThanEntryPointInMxmlRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/AbstractMoreThanEntryPointInMxmlRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/AbstractMoreThanEntryPointInMxmlRule.java
new file mode 100644
index 0000000..1c3cb7e
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/AbstractMoreThanEntryPointInMxmlRule.java
@@ -0,0 +1,101 @@
+/*
+ * 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 org.apache.flex.pmd.rules.mxml;
+
+import org.apache.flex.pmd.nodes.IAttribute;
+import org.apache.flex.pmd.nodes.IClass;
+import org.apache.flex.pmd.nodes.IFunction;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+abstract class AbstractMoreThanEntryPointInMxmlRule extends AbstractAstFlexRule {
+    private int lastPublicVarLine = 0;
+    private int publicVarCount = 0;
+
+    /**
+     * @return
+     */
+    public abstract int getThreshold();
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#isConcernedByTheCurrentFile
+     * ()
+     */
+    @Override
+    public final 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) {
+        publicVarCount = 0;
+        lastPublicVarLine = 0;
+
+        super.findViolations(classNode);
+
+        if (publicVarCount > getThreshold()) {
+            addViolation(ViolationPosition.create(lastPublicVarLine,
+                    lastPublicVarLine,
+                    0,
+                    getCurrentFile().getLineAt(lastPublicVarLine - 1).length()));
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+     * .ac.pmd.nodes.IFunction)
+     */
+    @Override
+    protected final void findViolations(final IFunction function) {
+        if (function.isPublic()
+                && function.isSetter()) {
+            publicVarCount++;
+            lastPublicVarLine = function.getInternalNode().getLine();
+        }
+    }
+
+    /*
+     * (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) {
+            if (attribute.isPublic()) {
+                publicVarCount++;
+                lastPublicVarLine = attribute.getInternalNode().getLine();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/CodeBehindInMxmlRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/CodeBehindInMxmlRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/CodeBehindInMxmlRule.java
new file mode 100644
index 0000000..4789dcb
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/CodeBehindInMxmlRule.java
@@ -0,0 +1,63 @@
+/*
+ * 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 org.apache.flex.pmd.rules.mxml;
+
+import org.apache.flex.pmd.rules.core.AbstractRegexpBasedRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class CodeBehindInMxmlRule extends AbstractRegexpBasedRule {
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractFlexRule#isConcernedByTheCurrentFile()
+     */
+    @Override
+    public final boolean isConcernedByTheCurrentFile() {
+        return getCurrentFile().isMxml();
+    }
+
+    /*
+     * (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.AbstractRegexpBasedRule#getRegexp()
+     */
+    @Override
+    protected final String getRegexp() {
+        return ".*<.*Script.*";
+    }
+
+    /*
+     * (non-Javadoc)
+     * @seecom.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#
+     * isViolationDetectedOnThisMatchingLine(java.lang.String)
+     */
+    @Override
+    protected final boolean isViolationDetectedOnThisMatchingLine(final String line) {
+        return line.contains("source");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/MoreThanOneEntryPointInMxmlRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/MoreThanOneEntryPointInMxmlRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/MoreThanOneEntryPointInMxmlRule.java
new file mode 100644
index 0000000..fe5d52e
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/MoreThanOneEntryPointInMxmlRule.java
@@ -0,0 +1,44 @@
+/*
+ * 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 org.apache.flex.pmd.rules.mxml;
+
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class MoreThanOneEntryPointInMxmlRule extends AbstractMoreThanEntryPointInMxmlRule {
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.mxml.AbstractMoreThanEntryPointInMxmlRule#getThreshold
+     * ()
+     */
+    @Override
+    public final int getThreshold() {
+        return 1;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.LOW;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/MoreThanTwoEntryPointsInMxmlRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/MoreThanTwoEntryPointsInMxmlRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/MoreThanTwoEntryPointsInMxmlRule.java
new file mode 100644
index 0000000..ca034fc
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/MoreThanTwoEntryPointsInMxmlRule.java
@@ -0,0 +1,44 @@
+/*
+ * 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 org.apache.flex.pmd.rules.mxml;
+
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class MoreThanTwoEntryPointsInMxmlRule extends AbstractMoreThanEntryPointInMxmlRule {
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.mxml.AbstractMoreThanEntryPointInMxmlRule#getThreshold
+     * ()
+     */
+    @Override
+    public final int getThreshold() {
+        return 2;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.NORMAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/OnlyOneScriptBlockPerMxmlRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/OnlyOneScriptBlockPerMxmlRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/OnlyOneScriptBlockPerMxmlRule.java
new file mode 100644
index 0000000..d26f7b1
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/OnlyOneScriptBlockPerMxmlRule.java
@@ -0,0 +1,89 @@
+/*
+ * 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 org.apache.flex.pmd.rules.mxml;
+
+import org.apache.flex.pmd.rules.IFlexViolation;
+import org.apache.flex.pmd.rules.core.AbstractXpathRelatedRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+import org.w3c.dom.Document;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+public class OnlyOneScriptBlockPerMxmlRule extends AbstractXpathRelatedRule {
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractXpathRelatedRule#evaluate(org.w3c.
+     * dom.Document, javax.xml.xpath.XPath)
+     */
+    @Override
+    protected Object evaluate(final Document doc,
+                              final XPath xPath) throws XPathExpressionException {
+        return xPath.evaluate(getXPathExpression(),
+                doc,
+                XPathConstants.NUMBER);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.HIGH;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractXpathRelatedRule#getXPathExpression()
+     */
+    @Override
+    protected String getXPathExpression() {
+        return "count(//mx:Script)";
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractXpathRelatedRule#onEvaluated(java.
+     * util.List, org.w3c.dom.Document, javax.xml.xpath.XPath)
+     */
+    @Override
+    protected void onEvaluated(final List<IFlexViolation> violations,
+                               final Document doc,
+                               final XPath xPath) throws XPathExpressionException {
+        final Double scriptNb = (Double) evaluate(doc,
+                xPath);
+
+        if (scriptNb >= 2) {
+            addViolation(violations,
+                    ViolationPosition.create(1,
+                            1,
+                            0,
+                            0),
+                    String.valueOf(scriptNb));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/StaticMethodInMxmlRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/StaticMethodInMxmlRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/StaticMethodInMxmlRule.java
new file mode 100644
index 0000000..255d1db
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/StaticMethodInMxmlRule.java
@@ -0,0 +1,61 @@
+/*
+ * 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 org.apache.flex.pmd.rules.mxml;
+
+import org.apache.flex.pmd.nodes.IFunction;
+import org.apache.flex.pmd.nodes.Modifier;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class StaticMethodInMxmlRule extends AbstractAstFlexRule {
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#isConcernedByTheCurrentFile
+     * ()
+     */
+    @Override
+    public final boolean isConcernedByTheCurrentFile() {
+        return getCurrentFile().isMxml();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+     * .ac.pmd.nodes.IFunction)
+     */
+    @Override
+    protected final void findViolations(final IFunction function) {
+        if (function.is(Modifier.STATIC)) {
+            addViolation(function);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.LOW;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/TooLongScriptBlockRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/TooLongScriptBlockRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/TooLongScriptBlockRule.java
new file mode 100644
index 0000000..349a0bc
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/TooLongScriptBlockRule.java
@@ -0,0 +1,92 @@
+/*
+ * 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 org.apache.flex.pmd.rules.mxml;
+
+import org.apache.flex.pmd.files.IMxmlFile;
+import org.apache.flex.pmd.rules.IFlexViolation;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+import org.apache.flex.pmd.rules.core.thresholded.AbstractMaximizedFlexRule;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+public class TooLongScriptBlockRule extends AbstractMaximizedFlexRule {
+    public static final int DEFAULT_THRESHOLD = 50;
+    private int linesInScriptBlock;
+
+    /*
+     * (non-Javadoc)
+     * @seecom.adobe.ac.pmd.rules.core.thresholded.IThresholdedRule#
+     * getActualValueForTheCurrentViolation()
+     */
+    public final int getActualValueForTheCurrentViolation() {
+        return linesInScriptBlock;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.thresholded.IThresholdedRule#getDefaultThreshold
+     * ()
+     */
+    public final int getDefaultThreshold() {
+        return DEFAULT_THRESHOLD;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractFlexRule#isConcernedByTheCurrentFile()
+     */
+    @Override
+    public final boolean isConcernedByTheCurrentFile() {
+        return getCurrentFile().isMxml();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractFlexRule#findViolationsInCurrentFile()
+     */
+    @Override
+    protected final List<IFlexViolation> findViolationsInCurrentFile() {
+        final List<IFlexViolation> violations = new ArrayList<IFlexViolation>();
+        final IMxmlFile mxml = (IMxmlFile) getCurrentFile();
+
+        linesInScriptBlock = mxml.getEndingScriptBlock()
+                - mxml.getBeginningScriptBlock();
+
+        if (linesInScriptBlock >= getThreshold()) {
+            addViolation(violations,
+                    new ViolationPosition(mxml.getBeginningScriptBlock(), mxml.getEndingScriptBlock()));
+        }
+        return violations;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.NORMAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/TooManyStatesInMxmlRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/TooManyStatesInMxmlRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/TooManyStatesInMxmlRule.java
new file mode 100644
index 0000000..ae80b69
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/mxml/TooManyStatesInMxmlRule.java
@@ -0,0 +1,135 @@
+/*
+ * 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 org.apache.flex.pmd.rules.mxml;
+
+import net.sourceforge.pmd.PropertyDescriptor;
+import org.apache.flex.pmd.rules.IFlexViolation;
+import org.apache.flex.pmd.rules.core.AbstractXpathRelatedRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+import org.apache.flex.pmd.rules.core.thresholded.IThresholdedRule;
+import org.w3c.dom.Document;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+public class TooManyStatesInMxmlRule extends AbstractXpathRelatedRule implements IThresholdedRule {
+    private Double statesNb = 0.0;
+
+    /*
+     * (non-Javadoc)
+     * @seecom.adobe.ac.pmd.rules.core.thresholded.IThresholdedRule#
+     * getActualValueForTheCurrentViolation()
+     */
+    public int getActualValueForTheCurrentViolation() {
+        return statesNb.intValue();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.thresholded.IThresholdedRule#getDefaultThreshold
+     * ()
+     */
+    public int getDefaultThreshold() {
+        return 5;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.thresholded.IThresholdedRule#getThreshold()
+     */
+    public int getThreshold() {
+        return getProperty((PropertyDescriptor<Integer>) getPropertyDescriptor(getThresholdName()));
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.thresholded.IThresholdedRule#getThresholdName
+     * ()
+     */
+    public final String getThresholdName() {
+        return MAXIMUM;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractXpathRelatedRule#evaluate(org.w3c.
+     * dom.Document, javax.xml.xpath.XPath)
+     */
+    @Override
+    protected Object evaluate(final Document doc,
+                              final XPath xPath) throws XPathExpressionException {
+        return xPath.evaluate(getXPathExpression(),
+                doc,
+                XPathConstants.NUMBER);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.NORMAL;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractXpathRelatedRule#getXPathExpression()
+     */
+    @Override
+    protected String getXPathExpression() {
+        return "count(//mx:states/*)";
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractXpathRelatedRule#onEvaluated(java.
+     * util.List, org.w3c.dom.Document, javax.xml.xpath.XPath)
+     */
+    @Override
+    protected void onEvaluated(final List<IFlexViolation> violations,
+                               final Document doc,
+                               final XPath xPath) throws XPathExpressionException {
+        statesNb = (Double) evaluate(doc,
+                xPath);
+
+        if (statesNb >= getThreshold()) {
+            xPath.evaluate("//mx:states/*",
+                    doc,
+                    XPathConstants.NODESET);
+
+            addViolation(violations,
+                    ViolationPosition.create(1,
+                            1,
+                            0,
+                            0),
+                    String.valueOf(getActualValueForTheCurrentViolation()));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/BooleanAttributeShouldContainIsHasRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/BooleanAttributeShouldContainIsHasRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/BooleanAttributeShouldContainIsHasRule.java
new file mode 100644
index 0000000..cff8d3a
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/BooleanAttributeShouldContainIsHasRule.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.flex.pmd.rules.naming;
+
+import org.apache.flex.pmd.nodes.IAttribute;
+import org.apache.flex.pmd.nodes.IFunction;
+import org.apache.flex.pmd.nodes.INamableNode;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+import java.util.List;
+
+public class BooleanAttributeShouldContainIsHasRule extends AbstractAstFlexRule {
+    private static final String BOOLEAN = "Boolean";
+    private static final String[] FORBIDDEN_NAMES = new String[]
+            {"has",
+                    "is",
+                    "can"};
+
+    @Override
+    protected void findViolations(final IFunction function) {
+        if (function.isGetter()
+                && function.isPublic() && function.getReturnType().toString().compareTo(BOOLEAN) == 0) {
+            isWronglyNamed(function);
+        }
+    }
+
+    @Override
+    protected void findViolationsFromAttributes(final List<IAttribute> variables) {
+        for (final IAttribute variable : variables) {
+            if (variable.getName().compareTo(BOOLEAN) == 0) {
+                isWronglyNamed(variable);
+            }
+        }
+    }
+
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.LOW;
+    }
+
+    private void isWronglyNamed(final INamableNode namable) {
+        for (final String forbiddenName : FORBIDDEN_NAMES) {
+            if (namable.getName().startsWith(forbiddenName)) {
+                return;
+            }
+        }
+        addViolation(namable,
+                namable.getName());
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/CapitalizeConstantsRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/CapitalizeConstantsRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/CapitalizeConstantsRule.java
new file mode 100644
index 0000000..d2a5686
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/CapitalizeConstantsRule.java
@@ -0,0 +1,45 @@
+/*
+ * 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 org.apache.flex.pmd.rules.naming;
+
+import org.apache.flex.pmd.nodes.IConstant;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+import java.util.List;
+import java.util.Locale;
+
+public class CapitalizeConstantsRule extends AbstractAstFlexRule {
+    @Override
+    protected void findViolationsFromConstants(final List<IConstant> constants) {
+        for (final IConstant constant : constants) {
+            if (nameContainsLowerCase(constant.getName())) {
+                addViolation(constant,
+                        constant.getName());
+            }
+        }
+    }
+
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.NORMAL;
+    }
+
+    private boolean nameContainsLowerCase(final String name) {
+        return name.toUpperCase(Locale.getDefault()).compareTo(name) != 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/IncorrectClassCase.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/IncorrectClassCase.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/IncorrectClassCase.java
new file mode 100644
index 0000000..618c5d3
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/IncorrectClassCase.java
@@ -0,0 +1,52 @@
+/*
+ * 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 org.apache.flex.pmd.rules.naming;
+
+import org.apache.flex.pmd.nodes.IClass;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class IncorrectClassCase extends AbstractAstFlexRule {
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+     * .ac.pmd.nodes.IClass)
+     */
+    @Override
+    protected final void findViolations(final IClass classNode) {
+        final char firstChar = classNode.getName().charAt(0);
+
+        if (firstChar < 'A'
+                || firstChar > 'Z') {
+            addViolation(new ViolationPosition(1, getCurrentFile().getLinesNb()));
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.NORMAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/IncorrectEventHandlerNameRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/IncorrectEventHandlerNameRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/IncorrectEventHandlerNameRule.java
new file mode 100644
index 0000000..a901685
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/IncorrectEventHandlerNameRule.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.flex.pmd.rules.naming;
+
+import net.sourceforge.pmd.lang.rule.properties.StringProperty;
+import org.apache.flex.pmd.nodes.IFunction;
+import org.apache.flex.pmd.parser.IParserNode;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+public class IncorrectEventHandlerNameRule extends AbstractAstFlexRule {
+
+    private static final StringProperty PREFIX_DESCRIPTOR = new StringProperty(
+            "prefix",
+            "",
+            "on",
+            1.0f
+    );
+    private static final StringProperty SUFFIX_DESCRIPTOR = new StringProperty(
+            "suffix",
+            "",
+            "",
+            1.0f
+    );
+
+    private final String prefix;
+    private final String suffix;
+
+    public IncorrectEventHandlerNameRule() {
+        super();
+        prefix = getProperty(PREFIX_DESCRIPTOR);
+        suffix = getProperty(SUFFIX_DESCRIPTOR);
+    }
+
+    @Override
+    protected void findViolations(final IFunction function) {
+        if (function.isEventHandler()
+                && !(function.getName().startsWith(prefix) && function.getName().endsWith(suffix))) {
+            final IParserNode name = getNameFromFunctionDeclaration(function.getInternalNode());
+
+            addViolation(name,
+                    name.getStringValue(),
+                    prefix,
+                    suffix);
+        }
+    }
+
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.LOW;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/InterfaceNamingRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/InterfaceNamingRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/InterfaceNamingRule.java
new file mode 100644
index 0000000..1638d2d
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/InterfaceNamingRule.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 org.apache.flex.pmd.rules.naming;
+
+import org.apache.flex.pmd.nodes.IClass;
+import org.apache.flex.pmd.parser.NodeKind;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+public class InterfaceNamingRule extends AbstractAstFlexRule {
+    @Override
+    protected void findViolations(final IClass classNode) {
+        if (classNode.getInternalNode().is(NodeKind.INTERFACE)
+                && !classNode.getName().startsWith("I")) {
+            addViolation(classNode);
+        }
+    }
+
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.HIGH;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/PackageCaseRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/PackageCaseRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/PackageCaseRule.java
new file mode 100644
index 0000000..c9833df
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/PackageCaseRule.java
@@ -0,0 +1,69 @@
+/*
+ * 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 org.apache.flex.pmd.rules.naming;
+
+import org.apache.flex.pmd.nodes.IPackage;
+import org.apache.flex.pmd.rules.IFlexViolation;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class PackageCaseRule extends AbstractAstFlexRule {
+    /*
+     * (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) {
+        if (containsUpperCharacter(packageNode.getName())) {
+            final IFlexViolation violation = addViolation(packageNode,
+                    packageNode.getName());
+
+            violation.setEndColumn(packageNode.getName().length()
+                    + violation.getBeginColumn());
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.NORMAL;
+    }
+
+    private boolean containsUpperCharacter(final String packageName) {
+        boolean found = false;
+
+        for (int i = 1; i < packageName.length(); i++) {
+            final char currentChar = packageName.charAt(i);
+
+            if (currentChar >= 'A'
+                    && currentChar <= 'Z' && packageName.charAt(i - 1) == '.') {
+                found = true;
+
+                break;
+            }
+        }
+        return found;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/PropertyHiddenByLocalVariableRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/PropertyHiddenByLocalVariableRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/PropertyHiddenByLocalVariableRule.java
new file mode 100644
index 0000000..c968580
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/PropertyHiddenByLocalVariableRule.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.flex.pmd.rules.naming;
+
+import org.apache.flex.pmd.nodes.IAttribute;
+import org.apache.flex.pmd.nodes.IClass;
+import org.apache.flex.pmd.nodes.IFunction;
+import org.apache.flex.pmd.nodes.IVariable;
+import org.apache.flex.pmd.rules.core.AbstractAstFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author xagnetti
+ */
+public class PropertyHiddenByLocalVariableRule extends AbstractAstFlexRule {
+    /*
+     * (non-Javadoc)
+     * @see
+     * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+     * .ac.pmd.nodes.IClass)
+     */
+    @Override
+    protected final void findViolations(final IClass classNode) {
+        final List<IAttribute> variables = classNode.getAttributes();
+
+        if (classNode.getFunctions() != null) {
+            for (final IFunction function : classNode.getFunctions()) {
+                final Set<String> localVariables = function.getLocalVariables().keySet();
+
+                for (final String localVariable : localVariables) {
+                    for (final IVariable field : variables) {
+                        if (localVariable.equals(field.getName())) {
+                            addViolation(function.getLocalVariables().get(localVariable),
+                                    field.getName());
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+     */
+    @Override
+    protected final ViolationPriority getDefaultPriority() {
+        return ViolationPriority.NORMAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/TooLongFunctionNameRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/TooLongFunctionNameRule.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/TooLongFunctionNameRule.java
new file mode 100644
index 0000000..60b255d
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/main/java/org/apache/flex/pmd/rules/naming/TooLongFunctionNameRule.java
@@ -0,0 +1,49 @@
+/*
+ * 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 org.apache.flex.pmd.rules.naming;
+
+import org.apache.flex.pmd.nodes.IFunction;
+import org.apache.flex.pmd.rules.core.ViolationPriority;
+import org.apache.flex.pmd.rules.core.thresholded.AbstractMaximizedAstFlexRule;
+
+public class TooLongFunctionNameRule extends AbstractMaximizedAstFlexRule {
+    private static final int DEFAULT_THRESHOLD = 25;
+    private int currentMethodNameLength;
+
+    @Override
+    public int getActualValueForTheCurrentViolation() {
+        return currentMethodNameLength;
+    }
+
+    @Override
+    public int getDefaultThreshold() {
+        return DEFAULT_THRESHOLD;
+    }
+
+    @Override
+    protected void findViolations(final IFunction function) {
+        currentMethodNameLength = function.getName().length();
+        if (currentMethodNameLength > getThreshold()) {
+            addViolation(function);
+        }
+    }
+
+    @Override
+    protected ViolationPriority getDefaultPriority() {
+        return ViolationPriority.NORMAL;
+    }
+}


Mime
View raw message