You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/04/25 08:18:15 UTC
[16/46] FlexPMD Donation from Adobe Systems Inc
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/component/UpdateChildrenNumberInUpdateDisplayListRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/component/UpdateChildrenNumberInUpdateDisplayListRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/component/UpdateChildrenNumberInUpdateDisplayListRule.java
new file mode 100644
index 0000000..642d3cc
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/component/UpdateChildrenNumberInUpdateDisplayListRule.java
@@ -0,0 +1,66 @@
+/*
+ * 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.component;
+
+import com.adobe.ac.pmd.nodes.IFunction;
+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 UpdateChildrenNumberInUpdateDisplayListRule extends AbstractAstFlexRule // NO_UCD
+{
+ private static final String[] METHOD_NAMES =
+ { "addChild",
+ "addChildAt",
+ "removeChild",
+ "removeChildAt" };
+ private static final String UPDATE_DISPLAY_LIST = "updateDisplayList";
+
+ /*
+ * (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.getName().equals( UPDATE_DISPLAY_LIST ) )
+ {
+ for ( final String methodName : METHOD_NAMES )
+ {
+ for ( final IParserNode statement : function.findPrimaryStatementsInBody( methodName ) )
+ {
+ addViolation( statement );
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.HIGH;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/css/StyleBlockInMxmlRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/css/StyleBlockInMxmlRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/css/StyleBlockInMxmlRule.java
new file mode 100644
index 0000000..15fa24a
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/css/StyleBlockInMxmlRule.java
@@ -0,0 +1,68 @@
+/*
+ * 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.css;
+
+import com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class StyleBlockInMxmlRule 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.NORMAL;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#getRegexp()
+ */
+ @Override
+ protected final String getRegexp()
+ {
+ return ".*<mx:Style>.*";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @seecom.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#
+ * isViolationDetectedOnThisMatchingLine(java.lang.String)
+ */
+ @Override
+ protected final boolean isViolationDetectedOnThisMatchingLine( final String line )
+ {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/css/UseCssInsteadOfEmbedMetaDataRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/css/UseCssInsteadOfEmbedMetaDataRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/css/UseCssInsteadOfEmbedMetaDataRule.java
new file mode 100644
index 0000000..cc9c5b3
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/css/UseCssInsteadOfEmbedMetaDataRule.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 com.adobe.ac.pmd.rules.css;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.nodes.IAttribute;
+import com.adobe.ac.pmd.nodes.IConstant;
+import com.adobe.ac.pmd.nodes.IMetaData;
+import com.adobe.ac.pmd.nodes.IMetaDataListHolder;
+import com.adobe.ac.pmd.nodes.MetaData;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class UseCssInsteadOfEmbedMetaDataRule extends AbstractAstFlexRule
+{
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolationsFromAttributes
+ * (java.util.List)
+ */
+ @Override
+ protected final void findViolationsFromAttributes( final List< IAttribute > variables )
+ {
+ super.findViolationsFromAttributes( variables );
+
+ findViolationsInMetaDataList( variables );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolationsFromConstants
+ * (java.util.List)
+ */
+ @Override
+ protected final void findViolationsFromConstants( final List< IConstant > constants )
+ {
+ super.findViolationsFromConstants( constants );
+
+ findViolationsInMetaDataList( constants );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.LOW;
+ }
+
+ private void findViolationsInMetaDataList( final List< ? extends IMetaDataListHolder > metaDataList )
+ {
+ for ( final IMetaDataListHolder metaData : metaDataList )
+ {
+ final List< IMetaData > embedList = metaData.getMetaData( MetaData.EMBED );
+
+ if ( embedList != null )
+ {
+ addViolation( embedList.get( 0 ) );
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/AbstractEmptyBlockRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/AbstractEmptyBlockRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/AbstractEmptyBlockRule.java
new file mode 100644
index 0000000..9f92476
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/AbstractEmptyBlockRule.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.empty;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+import com.adobe.ac.pmd.parser.NodeKind;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+
+/**
+ * @author xagnetti
+ */
+public abstract class AbstractEmptyBlockRule extends AbstractAstFlexRule
+{
+ /**
+ * @param block
+ * @return
+ */
+ protected static boolean isBlockEmpty( final IParserNode block )
+ {
+ return block.is( NodeKind.BLOCK )
+ && block.numChildren() == 0 || block.is( NodeKind.STMT_EMPTY );
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/EmptyCatchStatementRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/EmptyCatchStatementRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/EmptyCatchStatementRule.java
new file mode 100644
index 0000000..b73a29e
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/EmptyCatchStatementRule.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.empty;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class EmptyCatchStatementRule extends AbstractEmptyBlockRule
+{
+ /*
+ * (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#visitCatch(com.adobe.ac
+ * .pmd.parser.IParserNode)
+ */
+ @Override
+ protected final void visitCatch( final IParserNode ast )
+ {
+ super.visitCatch( ast );
+
+ if ( isBlockEmpty( ast.getChild( 2 ) ) )
+ {
+ addViolation( ast );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/EmptyIfStmtRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/EmptyIfStmtRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/EmptyIfStmtRule.java
new file mode 100644
index 0000000..2774d93
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/empty/EmptyIfStmtRule.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.empty;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class EmptyIfStmtRule extends AbstractEmptyBlockRule
+{
+ /*
+ * (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 );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/AbstractEventRelatedRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/AbstractEventRelatedRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/AbstractEventRelatedRule.java
new file mode 100644
index 0000000..b6d4514
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/AbstractEventRelatedRule.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 com.adobe.ac.pmd.rules.event;
+
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+
+/**
+ * @author xagnetti
+ */
+public abstract class AbstractEventRelatedRule 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.IClass)
+ */
+ @Override
+ protected void findViolations( final IClass classNode )
+ {
+ if ( classNode.getExtensionName() != null
+ && classNode.getExtensionName().endsWith( "Event" ) )
+ {
+ super.findViolations( classNode );
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/ConstructorDispatchingEventRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/ConstructorDispatchingEventRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/ConstructorDispatchingEventRule.java
new file mode 100644
index 0000000..1d9945e
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/ConstructorDispatchingEventRule.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 com.adobe.ac.pmd.rules.event;
+
+import com.adobe.ac.pmd.nodes.IFunction;
+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 ConstructorDispatchingEventRule 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#findViolationsFromConstructor
+ * (com.adobe.ac.pmd.nodes.IFunction)
+ */
+ @Override
+ protected final void findViolationsFromConstructor( final IFunction constructor )
+ {
+ for ( final IParserNode statement : constructor.findPrimaryStatementsInBody( "dispatchEvent" ) )
+ {
+ addViolation( statement );
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.HIGH;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/DefaultEventNameRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/DefaultEventNameRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/DefaultEventNameRule.java
new file mode 100644
index 0000000..523490a
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/DefaultEventNameRule.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.event;
+
+import com.adobe.ac.pmd.nodes.IFunction;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class DefaultEventNameRule extends AbstractEventRelatedRule
+{
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolationsFromConstructor
+ * (com.adobe.ac.pmd.nodes.IFunction)
+ */
+ @Override
+ protected final void findViolationsFromConstructor( final IFunction constructor )
+ {
+ if ( constructor.getParameters().size() > 0
+ && constructor.getParameters().get( 0 ).getType().toString().equals( "String" )
+ && constructor.getParameters().get( 0 ).getInitializationExpression() != null )
+ {
+ addViolation( constructor.getParameters().get( 0 ) );
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.HIGH;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/DispatchHardCodedEventNameRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/DispatchHardCodedEventNameRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/DispatchHardCodedEventNameRule.java
new file mode 100644
index 0000000..2770a12
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/DispatchHardCodedEventNameRule.java
@@ -0,0 +1,80 @@
+/*
+ * 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.event;
+
+import com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class DispatchHardCodedEventNameRule extends AbstractRegexpBasedRule
+{
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractFlexRule#isConcernedByTheCurrentFile()
+ */
+ @Override
+ public final boolean isConcernedByTheCurrentFile()
+ {
+ return true;
+ }
+
+ /*
+ * (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 ".*dispatchEvent *\\( *new Event\\( *(\"|\').*(\"|\') *\\) *\\).*";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#isCurrentLineConcerned
+ * (java.lang.String)
+ */
+ @Override
+ protected boolean isCurrentLineConcerned( final String line )
+ {
+ return line.contains( "dispatchEvent" );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @seecom.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#
+ * isViolationDetectedOnThisMatchingLine(java.lang.String)
+ */
+ @Override
+ protected final boolean isViolationDetectedOnThisMatchingLine( final String line )
+ {
+ return getMatcher( line ).matches();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/EventMissingCloneFunctionRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/EventMissingCloneFunctionRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/EventMissingCloneFunctionRule.java
new file mode 100644
index 0000000..69eca21
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/EventMissingCloneFunctionRule.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 com.adobe.ac.pmd.rules.event;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.IFunction;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class EventMissingCloneFunctionRule extends AbstractEventRelatedRule
+{
+ private IClass classNode = null;
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.event.AbstractEventRelatedRule#findViolations(com
+ * .adobe.ac.pmd.nodes.IClass)
+ */
+ @Override
+ protected final void findViolations( final IClass classNodeToBeSet )
+ {
+ classNode = classNodeToBeSet;
+ if ( "Event".equals( classNode.getExtensionName() ) )
+ {
+ super.findViolations( classNode );
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(java.util
+ * .List)
+ */
+ @Override
+ protected final void findViolations( final List< IFunction > functions )
+ {
+ boolean cloneFound = false;
+
+ for ( final IFunction functionNode : functions )
+ {
+ if ( "clone".equals( functionNode.getName() ) )
+ {
+ cloneFound = true;
+ break;
+ }
+ }
+ if ( !cloneFound )
+ {
+ addViolation( classNode );
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.HIGH;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/ListenForHardCodedEventNameRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/ListenForHardCodedEventNameRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/ListenForHardCodedEventNameRule.java
new file mode 100644
index 0000000..99d0a24
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/ListenForHardCodedEventNameRule.java
@@ -0,0 +1,80 @@
+/*
+ * 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.event;
+
+import com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class ListenForHardCodedEventNameRule extends AbstractRegexpBasedRule
+{
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractFlexRule#isConcernedByTheCurrentFile()
+ */
+ @Override
+ public final boolean isConcernedByTheCurrentFile()
+ {
+ return true;
+ }
+
+ /*
+ * (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 ".*addEventListener *\\( *(\"|\').*(\"|\').*";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#isCurrentLineConcerned
+ * (java.lang.String)
+ */
+ @Override
+ protected boolean isCurrentLineConcerned( final String line )
+ {
+ return line.contains( "addEventListener" );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @seecom.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule#
+ * isViolationDetectedOnThisMatchingLine(java.lang.String)
+ */
+ @Override
+ protected final boolean isViolationDetectedOnThisMatchingLine( final String line )
+ {
+ return getMatcher( line ).matches();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/PublicVariableInCustomEventRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/PublicVariableInCustomEventRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/PublicVariableInCustomEventRule.java
new file mode 100644
index 0000000..caaf913
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/PublicVariableInCustomEventRule.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.event;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.nodes.IAttribute;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class PublicVariableInCustomEventRule extends AbstractEventRelatedRule
+{
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolationsFromAttributes
+ * (java.util.List)
+ */
+ @Override
+ protected final void findViolationsFromAttributes( final List< IAttribute > variables )
+ {
+ for ( final IAttribute attribute : variables )
+ {
+ if ( attribute.isPublic() )
+ {
+ addViolation( attribute,
+ attribute.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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/UnboundTypeInMetadataRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/UnboundTypeInMetadataRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/UnboundTypeInMetadataRule.java
new file mode 100644
index 0000000..0dc7d2a
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/UnboundTypeInMetadataRule.java
@@ -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.
+ */
+package com.adobe.ac.pmd.rules.event;
+
+import java.util.List;
+import java.util.Map;
+
+import com.adobe.ac.pmd.files.IFlexFile;
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.IMetaData;
+import com.adobe.ac.pmd.nodes.MetaData;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class UnboundTypeInMetadataRule extends AbstractAstFlexRule
+{
+ private static final String TYPE = "type";
+
+ /*
+ * (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< IMetaData > eventMetaDatas = classNode.getMetaData( MetaData.EVENT );
+
+ if ( eventMetaDatas != null )
+ {
+ findViolationsInMetaDataNode( eventMetaDatas,
+ getFilesInSourcePath() );
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.NORMAL;
+ }
+
+ private void findViolationsInMetaDataNode( final List< IMetaData > eventMetaDatas,
+ final Map< String, IFlexFile > files )
+ {
+ for ( final IMetaData metaData : eventMetaDatas )
+ {
+ if ( metaData.getProperty( TYPE ).length > 0 )
+ {
+ final String type = metaData.getProperty( TYPE )[ 0 ];
+
+ if ( !files.containsKey( type
+ + ".as" )
+ && !type.startsWith( "mx." ) && !type.startsWith( "flash." ) )
+ {
+ addViolation( metaData,
+ type );
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/UntypedEventMetadataRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/UntypedEventMetadataRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/UntypedEventMetadataRule.java
new file mode 100644
index 0000000..8851615
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/event/UntypedEventMetadataRule.java
@@ -0,0 +1,71 @@
+/*
+ * 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.event;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.IMetaData;
+import com.adobe.ac.pmd.nodes.MetaData;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class UntypedEventMetadataRule 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< IMetaData > eventMetaData = classNode.getMetaData( MetaData.EVENT );
+
+ if ( eventMetaData != null )
+ {
+ findViolationsInMetaDataNode( eventMetaData );
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.LOW;
+ }
+
+ private void findViolationsInMetaDataNode( final List< IMetaData > eventMetaDatas )
+ {
+ for ( final IMetaData metaData : eventMetaDatas )
+ {
+ final String metaDataValue = metaData.getInternalNode().getStringValue();
+
+ if ( !metaDataValue.contains( "type = " ) )
+ {
+ addViolation( metaData );
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/flexunit/EmptyUnitTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/flexunit/EmptyUnitTest.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/flexunit/EmptyUnitTest.java
new file mode 100644
index 0000000..3980293
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/flexunit/EmptyUnitTest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.flexunit;
+
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.IFunction;
+import com.adobe.ac.pmd.nodes.MetaData;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public final class EmptyUnitTest extends AbstractAstFlexRule
+{
+ private static final String[] ASSERTIONS = new String[]
+ { "assertEquals",
+ "assertObjectEquals",
+ "assertMatch",
+ "assertNoMatch",
+ "assertContained",
+ "assertNotContained",
+ "assertStrictlyEquals",
+ "assertTrue",
+ "assertFalse",
+ "assertNull",
+ "assertNotNull",
+ "assertUndefined",
+ "assertNotUndefined",
+ "assertThat",
+ "handleEvent",
+ "assertEvents",
+ "fail" };
+
+ private boolean isExtendingTestCase;
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+ * .ac.pmd.nodes.IClass)
+ */
+ @Override
+ protected void findViolations( final IClass classNode )
+ {
+ isExtendingTestCase = classNode.getExtensionName() != null
+ && classNode.getExtensionName().endsWith( "TestCase" );
+
+ super.findViolations( classNode );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolations(com.adobe
+ * .ac.pmd.nodes.IFunction)
+ */
+ @Override
+ protected void findViolations( final IFunction function )
+ {
+ super.findViolations( function );
+
+ if ( isExtendingTestCase
+ && function.getName().startsWith( "test" )
+ && function.findPrimaryStatementInBody( ASSERTIONS ).isEmpty() )
+ {
+ addViolation( function );
+ }
+ if ( !function.getMetaData( MetaData.TEST ).isEmpty()
+ && function.findPrimaryStatementInBody( ASSERTIONS ).isEmpty() )
+ {
+ 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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AlertShowRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AlertShowRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AlertShowRule.java
new file mode 100644
index 0000000..8b8ac35
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AlertShowRule.java
@@ -0,0 +1,74 @@
+/*
+ * 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.maintanability;
+
+import com.adobe.ac.pmd.nodes.IFunction;
+import com.adobe.ac.pmd.parser.IParserNode;
+import com.adobe.ac.pmd.rules.core.AbstractPrimaryAstRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class AlertShowRule extends AbstractPrimaryAstRule
+{
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractPrimaryAstRule#addViolation(com.adobe
+ * .ac.pmd.parser.IParserNode, com.adobe.ac.pmd.nodes.IFunction)
+ */
+ @Override
+ protected void addViolation( final IParserNode statement,
+ final IFunction function )
+ {
+ addViolation( statement );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.LOW;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractPrimaryAstRule#getFirstPrimaryToFind()
+ */
+ @Override
+ protected String getFirstPrimaryToFind()
+ {
+ return "Alert";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractPrimaryAstRule#getSecondPrimaryToFind
+ * ()
+ */
+ @Override
+ protected String getSecondPrimaryToFind()
+ {
+ return "show";
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ArrayFieldWithNoArrayElementTypeRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ArrayFieldWithNoArrayElementTypeRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ArrayFieldWithNoArrayElementTypeRule.java
new file mode 100644
index 0000000..f1d8f90
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ArrayFieldWithNoArrayElementTypeRule.java
@@ -0,0 +1,93 @@
+/*
+ * 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.maintanability;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.nodes.IAttribute;
+import com.adobe.ac.pmd.nodes.IConstant;
+import com.adobe.ac.pmd.nodes.IField;
+import com.adobe.ac.pmd.nodes.MetaData;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class ArrayFieldWithNoArrayElementTypeRule extends AbstractAstFlexRule
+{
+ private static final String ARRAY_TYPE = "Array";
+
+ /*
+ * (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#findViolationsFromAttributes
+ * (java.util.List)
+ */
+ @Override
+ protected final void findViolationsFromAttributes( final List< IAttribute > variables )
+ {
+ findViolationFromFieds( variables );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#findViolationsFromConstants
+ * (java.util.List)
+ */
+ @Override
+ protected void findViolationsFromConstants( final List< IConstant > constants )
+ {
+ findViolationFromFieds( constants );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.NORMAL;
+ }
+
+ private void findViolationFromFieds( final List< ? extends IField > fields )
+ {
+ for ( final IField variable : fields )
+ {
+ if ( ARRAY_TYPE.equals( variable.getType().toString() )
+ && variable.getMetaData( MetaData.ARRAY_ELEMENT_TYPE ) == null )
+ {
+ addViolation( variable,
+ variable.getName() );
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidProtectedFieldInFinalClassRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidProtectedFieldInFinalClassRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidProtectedFieldInFinalClassRule.java
new file mode 100644
index 0000000..940ed49
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidProtectedFieldInFinalClassRule.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 com.adobe.ac.pmd.rules.maintanability;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.nodes.IAttribute;
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.IFunction;
+import com.adobe.ac.pmd.nodes.Modifier;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class AvoidProtectedFieldInFinalClassRule 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 boolean isClassFinal = classNode.isFinal();
+
+ findProtectedAttributes( classNode.getAttributes(),
+ isClassFinal );
+ findProtectedMethods( classNode.getFunctions(),
+ isClassFinal );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.LOW;
+ }
+
+ private void findProtectedAttributes( final List< IAttribute > atributes,
+ final boolean isClassFinal )
+ {
+ if ( atributes != null )
+ {
+ for ( final IAttribute field : atributes )
+ {
+ if ( field.is( Modifier.PROTECTED )
+ && isClassFinal )
+ {
+ addViolation( field,
+ field.getName() );
+ }
+ }
+ }
+ }
+
+ private void findProtectedMethods( final List< IFunction > functions,
+ final boolean isClassFinal )
+ {
+ if ( functions != null )
+ {
+ for ( final IFunction function : functions )
+ {
+ if ( function.is( Modifier.PROTECTED )
+ && !function.isOverriden() && isClassFinal )
+ {
+ addViolation( function );
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUseOfAsKeywordRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUseOfAsKeywordRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUseOfAsKeywordRule.java
new file mode 100644
index 0000000..b16dbe1
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUseOfAsKeywordRule.java
@@ -0,0 +1,48 @@
+/*
+ * 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.maintanability;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+import com.adobe.ac.pmd.parser.NodeKind;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+public class AvoidUseOfAsKeywordRule extends AbstractAstFlexRule
+{
+ @Override
+ protected ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.LOW;
+ }
+
+ @Override
+ protected void visitRelationalExpression( final IParserNode ast )
+ {
+ super.visitRelationalExpression( ast );
+
+ if ( ast.getChildren() != null )
+ {
+ for ( final IParserNode child : ast.getChildren() )
+ {
+ if ( child.is( NodeKind.AS ) )
+ {
+ addViolation( child );
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUsingPublicStaticFieldRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUsingPublicStaticFieldRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUsingPublicStaticFieldRule.java
new file mode 100644
index 0000000..39cdb90
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUsingPublicStaticFieldRule.java
@@ -0,0 +1,59 @@
+/*
+ * 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.maintanability;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.nodes.IAttribute;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class AvoidUsingPublicStaticFieldRule 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 )
+ {
+ if ( attribute.isPublic()
+ && attribute.isStatic() && !attribute.getName().contains( "instance" ) )
+ {
+ addViolation( attribute,
+ attribute.getName() );
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.HIGH;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUsingWithKeyWordRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUsingWithKeyWordRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUsingWithKeyWordRule.java
new file mode 100644
index 0000000..1c531ad
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/AvoidUsingWithKeyWordRule.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.maintanability;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.nodes.IFunction;
+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 AvoidUsingWithKeyWordRule 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 )
+ {
+ final List< IParserNode > withStatements = function.findPrimaryStatementsInBody( "with" );
+
+ for ( final IParserNode withStatement : withStatements )
+ {
+ addViolation( withStatement );
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.HIGH;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ClassAndExtensionAreIdenticalRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ClassAndExtensionAreIdenticalRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ClassAndExtensionAreIdenticalRule.java
new file mode 100644
index 0000000..cea669b
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ClassAndExtensionAreIdenticalRule.java
@@ -0,0 +1,68 @@
+/*
+ * 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.maintanability;
+
+import org.apache.commons.lang.StringUtils;
+
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class ClassAndExtensionAreIdenticalRule 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 String extensionName = classNode.getExtensionName();
+
+ if ( extensionName != null )
+ {
+ final String extension = extractExtensionName( extensionName );
+
+ if ( extension.equals( classNode.getName() ) )
+ {
+ addViolation( classNode );
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.HIGH;
+ }
+
+ private String extractExtensionName( final String extensionName )
+ {
+ return extensionName.indexOf( '.' ) == -1 ? extensionName
+ : StringUtils.substringAfterLast( extensionName,
+ "." );
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/DynamicClassRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/DynamicClassRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/DynamicClassRule.java
new file mode 100644
index 0000000..988db64
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/DynamicClassRule.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 com.adobe.ac.pmd.rules.maintanability;
+
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.Modifier;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @author xagnetti
+ */
+public class DynamicClassRule 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.IClass)
+ */
+ @Override
+ protected final void findViolations( final IClass classNode )
+ {
+ if ( classNode.is( Modifier.DYNAMIC ) )
+ {
+ addViolation( classNode );
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected final ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.HIGH;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/EmptyStatementRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/EmptyStatementRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/EmptyStatementRule.java
new file mode 100644
index 0000000..a659f83
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/EmptyStatementRule.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 com.adobe.ac.pmd.rules.maintanability;
+
+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 EmptyStatementRule extends AbstractAstFlexRule
+{
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.rules.core.AbstractFlexRule#getDefaultPriority()
+ */
+ @Override
+ protected ViolationPriority getDefaultPriority()
+ {
+ return ViolationPriority.LOW;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.AbstractAstFlexRule#visitEmptyStatetement(
+ * com.adobe.ac.pmd.parser.IParserNode)
+ */
+ @Override
+ protected void visitEmptyStatetement( final IParserNode statementNode )
+ {
+ addViolation( statementNode );
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ExcessiveImportRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ExcessiveImportRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ExcessiveImportRule.java
new file mode 100644
index 0000000..becf73e
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ExcessiveImportRule.java
@@ -0,0 +1,80 @@
+/*
+ * 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.maintanability;
+
+import com.adobe.ac.pmd.nodes.IPackage;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+import com.adobe.ac.pmd.rules.core.thresholded.AbstractMaximizedAstFlexRule;
+
+/**
+ * @author xagnetti
+ */
+public class ExcessiveImportRule extends AbstractMaximizedAstFlexRule
+{
+ private static final int DEFAULT_THRESHOLD = 15;
+ private int importNumber;
+
+ /*
+ * (non-Javadoc)
+ * @seecom.adobe.ac.pmd.rules.core.thresholded.IThresholdedRule#
+ * getActualValueForTheCurrentViolation()
+ */
+ @Override
+ public final int getActualValueForTheCurrentViolation()
+ {
+ return importNumber;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.rules.core.thresholded.IThresholdedRule#getDefaultThreshold
+ * ()
+ */
+ @Override
+ public final int getDefaultThreshold()
+ {
+ return DEFAULT_THRESHOLD;
+ }
+
+ /*
+ * (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 )
+ {
+ importNumber = packageNode.getImports().size();
+
+ if ( importNumber > getThreshold() )
+ {
+ addViolation( packageNode.getClassNode() );
+ }
+ }
+
+ /*
+ * (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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/NonStaticConstantFieldRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/NonStaticConstantFieldRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/NonStaticConstantFieldRule.java
new file mode 100644
index 0000000..a322ecd
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/NonStaticConstantFieldRule.java
@@ -0,0 +1,59 @@
+/*
+ * 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.maintanability;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.nodes.IConstant;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPriority;
+
+/**
+ * @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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/OnlyOneReturnRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/OnlyOneReturnRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/OnlyOneReturnRule.java
new file mode 100644
index 0000000..75f16f0
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/OnlyOneReturnRule.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.maintanability;
+
+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 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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ProtectedStaticMethodRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ProtectedStaticMethodRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ProtectedStaticMethodRule.java
new file mode 100644
index 0000000..0e67239
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ProtectedStaticMethodRule.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 com.adobe.ac.pmd.rules.maintanability;
+
+import com.adobe.ac.pmd.nodes.IFunction;
+import com.adobe.ac.pmd.nodes.Modifier;
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRule;
+import com.adobe.ac.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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ReferenceToVariableBindingFromItsInitializerRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ReferenceToVariableBindingFromItsInitializerRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ReferenceToVariableBindingFromItsInitializerRule.java
new file mode 100644
index 0000000..e62c3c6
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/ReferenceToVariableBindingFromItsInitializerRule.java
@@ -0,0 +1,91 @@
+/*
+ * 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.maintanability;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.nodes.IAttribute;
+import com.adobe.ac.pmd.nodes.IConstant;
+import com.adobe.ac.pmd.nodes.IField;
+import com.adobe.ac.pmd.nodes.IFieldInitialization;
+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 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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/TrueFalseConditionRule.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/TrueFalseConditionRule.java b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/TrueFalseConditionRule.java
new file mode 100644
index 0000000..e9ede97
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/main/java/com/adobe/ac/pmd/rules/maintanability/TrueFalseConditionRule.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 com.adobe.ac.pmd.rules.maintanability;
+
+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 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;
+ }
+}