You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2015/03/07 13:07:00 UTC
[07/24] git commit: [flex-utilities]
[refs/heads/feature/pmd-5.2-language-module] - Initial commit of the PMD
language module for Apache Flex
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/parsley/RedundantMethodAttributeRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/parsley/RedundantMethodAttributeRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/parsley/RedundantMethodAttributeRuleTest.java
new file mode 100644
index 0000000..b775c4f
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/parsley/RedundantMethodAttributeRuleTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.flex.pmd.rules.parsley;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class RedundantMethodAttributeRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("parsley.RedundantMethodAttribute.as", new ViolationPosition[]
+ {new ViolationPosition(29, 29)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new RedundantMethodAttributeRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/parsley/UnknownMetaDataAttributeRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/parsley/UnknownMetaDataAttributeRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/parsley/UnknownMetaDataAttributeRuleTest.java
new file mode 100644
index 0000000..76d4ad4
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/parsley/UnknownMetaDataAttributeRuleTest.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.parsley;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class UnknownMetaDataAttributeRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("parsley.UnknownMetaDataAttribute.as", new ViolationPosition[]
+ {new ViolationPosition(24, 24),
+ new ViolationPosition(27, 27),
+ new ViolationPosition(21, 21)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new UnknownMetaDataAttributeRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidDeclarationInLoopRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidDeclarationInLoopRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidDeclarationInLoopRuleTest.java
new file mode 100644
index 0000000..3cd2ae3
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidDeclarationInLoopRuleTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.performance;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class AvoidDeclarationInLoopRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("bug.FlexPMD181.as", new ViolationPosition[]
+ {new ViolationPosition(2326)}),
+ new ExpectedViolation("bug.FlexPMD88.as", new ViolationPosition[]
+ {new ViolationPosition(36)}),
+ new ExpectedViolation("com.adobe.ac.ncss.mxml.IterationsList.mxml",
+ new ViolationPosition[]
+ {new ViolationPosition(39),
+ new ViolationPosition(50),
+ new ViolationPosition(62)}),
+ new ExpectedViolation("com.adobe.ac.ncss.TestResult.as", new ViolationPosition[]
+ {new ViolationPosition(123),
+ new ViolationPosition(137)}),
+ new ExpectedViolation("Looping.as", new ViolationPosition[]
+ {new ViolationPosition(51)}),
+ new ExpectedViolation("PngEncoder.as", new ViolationPosition[]
+ {new ViolationPosition(188),
+ new ViolationPosition(207),
+ new ViolationPosition(323),
+ new ViolationPosition(324),
+ new ViolationPosition(325),
+ new ViolationPosition(326),
+ new ViolationPosition(327),
+ new ViolationPosition(328),
+ new ViolationPosition(329),
+ new ViolationPosition(330),
+ new ViolationPosition(333),
+ new ViolationPosition(334),
+ new ViolationPosition(335),
+ new ViolationPosition(336),
+ new ViolationPosition(341),
+ new ViolationPosition(351),
+ new ViolationPosition(352),
+ new ViolationPosition(353),
+ new ViolationPosition(354),
+ new ViolationPosition(356),
+ new ViolationPosition(357),
+ new ViolationPosition(370),
+ new ViolationPosition(371),
+ new ViolationPosition(372),
+ new ViolationPosition(373),
+ new ViolationPosition(374),
+ new ViolationPosition(375),
+ new ViolationPosition(376),
+ new ViolationPosition(377),
+ new ViolationPosition(380),
+ new ViolationPosition(381),
+ new ViolationPosition(382),
+ new ViolationPosition(383),
+ new ViolationPosition(388),
+ new ViolationPosition(398),
+ new ViolationPosition(399),
+ new ViolationPosition(400),
+ new ViolationPosition(401),
+ new ViolationPosition(403),
+ new ViolationPosition(404),
+ new ViolationPosition(575),
+ new ViolationPosition(578),
+ new ViolationPosition(580),
+ new ViolationPosition(600),
+ new ViolationPosition(601),
+ new ViolationPosition(602),
+ new ViolationPosition(603)}),
+ new ExpectedViolation("RadonDataGrid.as", new ViolationPosition[]
+ {new ViolationPosition(176)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new AvoidDeclarationInLoopRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidInstanciationInLoopRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidInstanciationInLoopRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidInstanciationInLoopRuleTest.java
new file mode 100644
index 0000000..f7c853e
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidInstanciationInLoopRuleTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.performance;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class AvoidInstanciationInLoopRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("PngEncoder.as", new ViolationPosition[]
+ {new ViolationPosition(238),
+ new ViolationPosition(265),
+ new ViolationPosition(272)}),
+ new ExpectedViolation("Looping.as", new ViolationPosition[]
+ {new ViolationPosition(31),
+ new ViolationPosition(34),
+ new ViolationPosition(38),
+ new ViolationPosition(44),
+ new ViolationPosition(47),
+ new ViolationPosition(51),
+ new ViolationPosition(56),
+ new ViolationPosition(59),
+ new ViolationPosition(63)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new AvoidInstanciationInLoopRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathCeilRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathCeilRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathCeilRuleTest.java
new file mode 100644
index 0000000..99fd230
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathCeilRuleTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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.performance;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+
+public class AvoidUsingMathCeilRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new AvoidUsingMathCeilRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathFloorRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathFloorRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathFloorRuleTest.java
new file mode 100644
index 0000000..a8079ee
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathFloorRuleTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.performance;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class AvoidUsingMathFloorRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("PngEncoder.as", new ViolationPosition[]
+ {new ViolationPosition(188),
+ new ViolationPosition(207)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new AvoidUsingMathFloorRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathRoundRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathRoundRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathRoundRuleTest.java
new file mode 100644
index 0000000..2afdf2c
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/AvoidUsingMathRoundRuleTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.flex.pmd.rules.performance;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class AvoidUsingMathRoundRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("PngEncoder.as", new ViolationPosition[]
+ {new ViolationPosition(417)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new AvoidUsingMathRoundRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/BindableClassRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/BindableClassRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/BindableClassRuleTest.java
new file mode 100644
index 0000000..3601608
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/BindableClassRuleTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.performance;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+import org.testng.annotations.Test;
+
+@Test(enabled = false) // This test requires test-data that was not donated to Apache
+public class BindableClassRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("bug.FlexPMD60.as", new ViolationPosition[]
+ {new ViolationPosition(19)}),
+ new ExpectedViolation("cairngorm.BindableModelLocator.as", new ViolationPosition[]
+ {new ViolationPosition(32)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new BindableClassRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/CreationPolicySetToAllRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/CreationPolicySetToAllRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/CreationPolicySetToAllRuleTest.java
new file mode 100644
index 0000000..9c5c6a5
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/CreationPolicySetToAllRuleTest.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 org.apache.flex.pmd.rules.performance;
+
+import org.apache.flex.pmd.rules.AbstractRegExpBasedRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractRegexpBasedRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class CreationPolicySetToAllRuleTest extends AbstractRegExpBasedRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("Main.mxml", new ViolationPosition[]
+ {new ViolationPosition(22)})};
+ }
+
+ @Override
+ protected String[] getMatchableLines() {
+ return new String[]
+ {"creationPolicy = Policy.ALL",
+ " creationPolicy=\"all\""};
+ }
+
+ @Override
+ protected AbstractRegexpBasedRule getRegexpBasedRule() {
+ return new CreationPolicySetToAllRule();
+ }
+
+ @Override
+ protected String[] getUnmatchableLines() {
+ return new String[]
+ {"creationPolic="};
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/CyclomaticComplexityRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/CyclomaticComplexityRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/CyclomaticComplexityRuleTest.java
new file mode 100644
index 0000000..4c1e957
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/CyclomaticComplexityRuleTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.performance;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class CyclomaticComplexityRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("bug.FlexPMD181.as", new ViolationPosition[]
+ {new ViolationPosition(2182),
+ new ViolationPosition(2280)}),
+ new ExpectedViolation("com.adobe.ac.ncss.LongSwitch.as", new ViolationPosition[]
+ {new ViolationPosition(27)}),
+ new ExpectedViolation("PngEncoder.as", new ViolationPosition[]
+ {new ViolationPosition(531)}),
+ new ExpectedViolation("RadonDataGrid.as", new ViolationPosition[]
+ {new ViolationPosition(148)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new CyclomaticComplexityRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/DeeplyNestedIfRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/DeeplyNestedIfRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/DeeplyNestedIfRuleTest.java
new file mode 100644
index 0000000..84567a0
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/DeeplyNestedIfRuleTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.performance;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class DeeplyNestedIfRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("bug.Duane.mxml", new ViolationPosition[]
+ {new ViolationPosition(73),
+ new ViolationPosition(77),
+ new ViolationPosition(82)}),
+ new ExpectedViolation("com.adobe.ac.AbstractRowData.as", new ViolationPosition[]
+ {new ViolationPosition(47)}),
+ new ExpectedViolation("PngEncoder.as", new ViolationPosition[]
+ {new ViolationPosition(561),
+ new ViolationPosition(559),
+ new ViolationPosition(567)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new DeeplyNestedIfRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/DynamicFiltersUsedInPopupTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/DynamicFiltersUsedInPopupTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/DynamicFiltersUsedInPopupTest.java
new file mode 100644
index 0000000..e7dcb20
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/DynamicFiltersUsedInPopupTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.performance;
+
+import org.apache.flex.pmd.rules.AbstractRegExpBasedRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractRegexpBasedRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class DynamicFiltersUsedInPopupTest extends AbstractRegExpBasedRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("filters.MyPopup.as", new ViolationPosition[]
+ {new ViolationPosition(25)}),
+ new ExpectedViolation("filters.MyPopup.mxml", new ViolationPosition[]
+ {new ViolationPosition(27),
+ new ViolationPosition(30)})};
+ }
+
+ @Override
+ protected String[] getMatchableLines() {
+ final String[] lines =
+ {"new DropShadowFilter",
+ "new GlowFilter",
+ "mx:DropShadowFilter"};
+ return lines;
+ }
+
+ @Override
+ protected AbstractRegexpBasedRule getRegexpBasedRule() {
+ return new DynamicFiltersUsedInPopup();
+ }
+
+ @Override
+ protected String[] getUnmatchableLines() {
+ final String[] lines =
+ {".filterFunction",
+ "DropShadowfilter("};
+ return lines;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/HeavyConstructorRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/HeavyConstructorRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/HeavyConstructorRuleTest.java
new file mode 100644
index 0000000..701dd94
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/HeavyConstructorRuleTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.performance;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class HeavyConstructorRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("bug.FlexPMD88.as", new ViolationPosition[]
+ {new ViolationPosition(26)}),
+ new ExpectedViolation("flexunit.RaoulTest.as", new ViolationPosition[]
+ {new ViolationPosition(59)}),
+ new ExpectedViolation("PngEncoder.as", new ViolationPosition[]
+ {new ViolationPosition(113)}),
+ new ExpectedViolation("Looping.as", new ViolationPosition[]
+ {new ViolationPosition(27)}),
+ new ExpectedViolation("RadonDataGrid.as", new ViolationPosition[]
+ {new ViolationPosition(41)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new HeavyConstructorRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/RecursiveStyleManagerRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/RecursiveStyleManagerRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/RecursiveStyleManagerRuleTest.java
new file mode 100644
index 0000000..cbb12f8
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/RecursiveStyleManagerRuleTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.performance;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class RecursiveStyleManagerRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("GoodComponent.as", new ViolationPosition[]
+ {new ViolationPosition(47),
+ new ViolationPosition(48)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new RecursiveStyleManagerRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/UseTraceFunctionRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/UseTraceFunctionRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/UseTraceFunctionRuleTest.java
new file mode 100644
index 0000000..b8c3d3f
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/performance/UseTraceFunctionRuleTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.performance;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class UseTraceFunctionRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("com.adobe.ac.ncss.LongSwitch.as", new ViolationPosition[]
+ {new ViolationPosition(113)}),
+ new ExpectedViolation("Simple.as", new ViolationPosition[]
+ {new ViolationPosition(1)}),
+ new ExpectedViolation("com.adobe.ac.ncss.BigImporterModel.as", new ViolationPosition[]
+ {new ViolationPosition(62),
+ new ViolationPosition(63)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new UseTraceFunctionRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/AllowAllSecureDomainRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/AllowAllSecureDomainRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/AllowAllSecureDomainRuleTest.java
new file mode 100644
index 0000000..ca5c6ae
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/AllowAllSecureDomainRuleTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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.security;
+
+import org.apache.flex.pmd.rules.AbstractRegExpBasedRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractRegexpBasedRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class AllowAllSecureDomainRuleTest extends AbstractRegExpBasedRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("bug.Security.as", new ViolationPosition[]
+ {new ViolationPosition(26)})};
+ }
+
+ @Override
+ protected String[] getMatchableLines() {
+ return new String[]
+ {"LocalConnection.allowDomain(\"*\")",
+ "LocalConnection.allowDomain( \"*\")",
+ "LocalConnection.allowDomain(\"*\" )",
+ "LocalConnection.allowDomain( \"*\" )",
+ "LocalConnection.allowDomain('*')",
+ "LocalConnection.allowDomain( '*')",
+ "LocalConnection.allowDomain('*' )",
+ "LocalConnection.allowDomain( '*' )",
+ "Security.allowDomain(\"*\")",
+ "Security.allowDomain( \"*\")",
+ "Security.allowDomain(\"*\" )",
+ "Security.allowDomain( \"*\" )",
+ "Security.allowDomain('*')",
+ "Security.allowDomain( '*')",
+ "Security.allowDomain('*' )",
+ "Security.allowDomain( '*' )"};
+ }
+
+ @Override
+ protected AbstractRegexpBasedRule getRegexpBasedRule() {
+ return new AllowAllSecureDomainRule();
+ }
+
+ @Override
+ protected String[] getUnmatchableLines() {
+ return new String[]
+ {"LocalConnection.allowDomain(\"www.google.com\")",
+ "LocalConnection.allowDomain( \"www.google.com\")",
+ "LocalConnection.allowDomain(\"www.google.com\" )",
+ "LocalConnection.allowDomain( \"www.google.com\" )",
+ "LocalConnection.allowDomain('www.google.com')",
+ "LocalConnection.allowDomain( 'www.google.com')",
+ "LocalConnection.allowDomain('www.google.com' )",
+ "LocalConnection.allowDomain( 'www.google.com' )",
+ "Security.allowDomain(\"www.google.com\")",
+ "Security.allowDomain( \"www.google.com\")",
+ "Security.allowDomain(\"www.google.com\" )",
+ "Security.allowDomain( \"www.google.com\" )",
+ "Security.allowDomain('www.google.com')",
+ "Security.allowDomain( 'www.google.com')",
+ "Security.allowDomain('www.google.com' )",
+ "Security.allowDomain( 'www.google.com' )"};
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/AllowInsecureDomainRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/AllowInsecureDomainRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/AllowInsecureDomainRuleTest.java
new file mode 100644
index 0000000..a9bb033
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/AllowInsecureDomainRuleTest.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.security;
+
+import org.apache.flex.pmd.rules.AbstractRegExpBasedRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractRegexpBasedRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class AllowInsecureDomainRuleTest extends AbstractRegExpBasedRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("bug.Security.as", new ViolationPosition[]
+ {new ViolationPosition(27),
+ new ViolationPosition(28)})};
+ }
+
+ @Override
+ protected String[] getMatchableLines() {
+ return new String[]
+ {"LocalConnection.allowInsecureDomain(\"www.example.org\")",
+ "Security.allowInsecureDomain(\"www.example.org\");"};
+ }
+
+ @Override
+ protected AbstractRegexpBasedRule getRegexpBasedRule() {
+ return new AllowInsecureDomainRule();
+ }
+
+ @Override
+ protected String[] getUnmatchableLines() {
+ return new String[]
+ {"LocalConnection.allowDomain(\"www.example.org\")",
+ "Security.allowDomain(\"www.example.org\");"};
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/ImportLoadBestPracticeRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/ImportLoadBestPracticeRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/ImportLoadBestPracticeRuleTest.java
new file mode 100644
index 0000000..1b5decd
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/ImportLoadBestPracticeRuleTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.security;
+
+import org.apache.flex.pmd.rules.AbstractRegExpBasedRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractRegexpBasedRule;
+
+public class ImportLoadBestPracticeRuleTest extends AbstractRegExpBasedRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {};
+ }
+
+ @Override
+ protected String[] getMatchableLines() {
+ return new String[]
+ {"SecurityDomain.currentDomain.loadBytes("};
+ }
+
+ @Override
+ protected AbstractRegexpBasedRule getRegexpBasedRule() {
+ return new ImportLoadBestPracticeRule();
+ }
+
+ @Override
+ protected String[] getUnmatchableLines() {
+ return new String[]
+ {"LocalConnection.allowDomain(\"www.example.org\")",
+ "Security.allowDomain(\"www.example.org\");",
+ "SecurityDomain.loadBytes"};
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/InsecureExactSettingsRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/InsecureExactSettingsRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/InsecureExactSettingsRuleTest.java
new file mode 100644
index 0000000..26325c6
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/InsecureExactSettingsRuleTest.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.security;
+
+import org.apache.flex.pmd.rules.AbstractRegExpBasedRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractRegexpBasedRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class InsecureExactSettingsRuleTest extends AbstractRegExpBasedRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("bug.Security.as", new ViolationPosition[]
+ {new ViolationPosition(29)})};
+ }
+
+ @Override
+ protected String[] getMatchableLines() {
+ return new String[]
+ {"Security.exactSettings = true;",
+ "Security.exactSettings = false;"};
+ }
+
+ @Override
+ protected AbstractRegexpBasedRule getRegexpBasedRule() {
+ return new InsecureExactSettingsRule();
+ }
+
+ @Override
+ protected String[] getUnmatchableLines() {
+ return new String[]
+ {"LocalConnection.allowDomain(\"www.example.org\")",
+ "Security.allowDomain(\"www.example.org\");",
+ "SecurityDomain.loadBytes"};
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/LSOSecureFalseRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/LSOSecureFalseRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/LSOSecureFalseRuleTest.java
new file mode 100644
index 0000000..efc0bff
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/LSOSecureFalseRuleTest.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.security;
+
+import org.apache.flex.pmd.rules.AbstractRegExpBasedRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractRegexpBasedRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class LSOSecureFalseRuleTest extends AbstractRegExpBasedRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("bug.Security.as", new ViolationPosition[]
+ {new ViolationPosition(33)})};
+ }
+
+ @Override
+ protected String[] getMatchableLines() {
+ return new String[]
+ {" LSO.getLocal(name, null, true);",
+ " LSO.getLocal( name,null,true );",
+ " LSO.getLocal(name,null,true);",
+ " LSO.getLocal(name,null,true)",
+ " LSO.getLocal(name, null, false);"};
+ }
+
+ @Override
+ protected AbstractRegexpBasedRule getRegexpBasedRule() {
+ return new LSOSecureFalseRule();
+ }
+
+ @Override
+ protected String[] getUnmatchableLines() {
+ return new String[]
+ {"LocalConnection.allowDomain(\"www.example.org\")",
+ "Security.allowDomain(\"www.example.org\");",
+ "SecurityDomain.loadBytes",
+ "LocalConnection.allowDomain(\"www.example.org\");"};
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/LocalConnectionStarRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/LocalConnectionStarRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/LocalConnectionStarRuleTest.java
new file mode 100644
index 0000000..c09641e
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/security/LocalConnectionStarRuleTest.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.security;
+
+import org.apache.flex.pmd.rules.AbstractRegExpBasedRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractRegexpBasedRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class LocalConnectionStarRuleTest extends AbstractRegExpBasedRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("bug.Security.as", new ViolationPosition[]
+ {new ViolationPosition(30)})};
+ }
+
+ @Override
+ protected String[] getMatchableLines() {
+ return new String[]
+ {" LocalConnection.allowDomain(\"*\");",
+ " LocalConnection.allowDomain( \"*\" );",
+ " LocalConnection.allowDomain('*');"};
+ }
+
+ @Override
+ protected AbstractRegexpBasedRule getRegexpBasedRule() {
+ return new LocalConnectionStarRule();
+ }
+
+ @Override
+ protected String[] getUnmatchableLines() {
+ return new String[]
+ {"LocalConnection.allowDomain(\"www.example.org\")",
+ "Security.allowDomain(\"www.example.org\");",
+ "SecurityDomain.loadBytes",
+ "LocalConnection.allowDomain(\"www.example.org\");"};
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooLongFunctionRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooLongFunctionRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooLongFunctionRuleTest.java
new file mode 100644
index 0000000..7f8804d
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooLongFunctionRuleTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.sizing;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+import java.util.LinkedHashMap;
+
+public class TooLongFunctionRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ new LinkedHashMap<String, ViolationPosition[]>();
+
+ return new ExpectedViolation[]
+ {new ExpectedViolation("cairngorm.FatController.as", new ViolationPosition[]
+ {new ViolationPosition(85)}),
+ new ExpectedViolation("com.adobe.ac.ncss.NestedSwitch.as", new ViolationPosition[]
+ {new ViolationPosition(23)}),
+ new ExpectedViolation("com.adobe.ac.ncss.LongSwitch.as", new ViolationPosition[]
+ {new ViolationPosition(27)}),
+ new ExpectedViolation("ErrorToltipSkin.as", new ViolationPosition[]
+ {new ViolationPosition(144)}),
+ new ExpectedViolation("PngEncoder.as", new ViolationPosition[]
+ {new ViolationPosition(133),
+ new ViolationPosition(318),
+ new ViolationPosition(531)}),
+ new ExpectedViolation("RadonDataGrid.as", new ViolationPosition[]
+ {new ViolationPosition(72)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new TooLongFunctionRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooLongSwitchCaseRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooLongSwitchCaseRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooLongSwitchCaseRuleTest.java
new file mode 100644
index 0000000..cb923c3
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooLongSwitchCaseRuleTest.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.sizing;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class TooLongSwitchCaseRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("ErrorToltipSkin.as", new ViolationPosition[]
+ {new ViolationPosition(177),
+ new ViolationPosition(202),
+ new ViolationPosition(240),
+ new ViolationPosition(278)}),
+ new ExpectedViolation("com.adobe.ac.ncss.NestedSwitch.as", new ViolationPosition[]
+ {new ViolationPosition(26),
+ new ViolationPosition(46)}),
+ new ExpectedViolation("com.adobe.ac.ncss.LongSwitch.as", new ViolationPosition[]
+ {new ViolationPosition(35),
+ new ViolationPosition(40)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new TooLongSwitchCaseRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFieldInVORuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFieldInVORuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFieldInVORuleTest.java
new file mode 100644
index 0000000..9e54492
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFieldInVORuleTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.flex.pmd.rules.sizing;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class TooManyFieldInVORuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("com.adobe.ac.ncss.ArrayVO.as", new ViolationPosition[]
+ {new ViolationPosition(21)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new TooManyFieldInVORule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFieldsRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFieldsRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFieldsRuleTest.java
new file mode 100644
index 0000000..bfbdfc9
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFieldsRuleTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.sizing;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class TooManyFieldsRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("com.adobe.ac.ncss.TestResult.as", new ViolationPosition[]
+ {new ViolationPosition(33)}),
+ new ExpectedViolation("Sorted.as", new ViolationPosition[]
+ {new ViolationPosition(25)}),
+ new ExpectedViolation("PngEncoder.as", new ViolationPosition[]
+ {new ViolationPosition(25)}),
+ new ExpectedViolation("com.adobe.ac.ncss.BigModel.as", new ViolationPosition[]
+ {new ViolationPosition(23)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new TooManyFieldsRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFunctionRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFunctionRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFunctionRuleTest.java
new file mode 100644
index 0000000..c8ffedf
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyFunctionRuleTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.sizing;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class TooManyFunctionRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("PngEncoder.as", new ViolationPosition[]
+ {new ViolationPosition(25)}),
+ new ExpectedViolation("com.adobe.ac.ncss.TestResult.as", new ViolationPosition[]
+ {new ViolationPosition(33)}),
+ new ExpectedViolation("com.adobe.ac.ncss.BigModel.as", new ViolationPosition[]
+ {new ViolationPosition(23)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new TooManyFunctionRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyParametersRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyParametersRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyParametersRuleTest.java
new file mode 100644
index 0000000..d8c2925
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyParametersRuleTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.sizing;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class TooManyParametersRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("RadonDataGrid.as", new ViolationPosition[]
+ {new ViolationPosition(56),
+ new ViolationPosition(72),
+ new ViolationPosition(105)}),
+ new ExpectedViolation("PngEncoder.as", new ViolationPosition[]
+ {new ViolationPosition(531)}),
+ new ExpectedViolation("com.adobe.ac.ncss.BigImporterModel.as", new ViolationPosition[]
+ {new ViolationPosition(50)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new TooManyParametersRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyPublicRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyPublicRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyPublicRuleTest.java
new file mode 100644
index 0000000..4e6db08
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/sizing/TooManyPublicRuleTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.sizing;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class TooManyPublicRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("com.adobe.ac.ncss.ArrayVO.as", new ViolationPosition[]
+ {new ViolationPosition(21)}),
+ new ExpectedViolation("com.adobe.ac.ncss.TestResult.as", new ViolationPosition[]
+ {new ViolationPosition(33)}),
+ new ExpectedViolation("com.adobe.ac.ncss.BigModel.as", new ViolationPosition[]
+ {new ViolationPosition(23)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new TooManyPublicRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/BadFormatLoggerRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/BadFormatLoggerRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/BadFormatLoggerRuleTest.java
new file mode 100644
index 0000000..bb66371
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/BadFormatLoggerRuleTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.style;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class BadFormatLoggerRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("AbstractRowData.as", new ViolationPosition[]
+ {new ViolationPosition(32),
+ new ViolationPosition(33),
+ new ViolationPosition(34),
+ new ViolationPosition(35)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new BadFormatLoggerRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/ConstructorNonEmptyReturnTypeRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/ConstructorNonEmptyReturnTypeRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/ConstructorNonEmptyReturnTypeRuleTest.java
new file mode 100644
index 0000000..ba20008
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/ConstructorNonEmptyReturnTypeRuleTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.flex.pmd.rules.style;
+
+import org.apache.flex.pmd.rules.AbstractAstFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class ConstructorNonEmptyReturnTypeRuleTest extends AbstractAstFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("com.adobe.ac.ncss.VoidConstructor.as", new ViolationPosition[]
+ {new ViolationPosition(25)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new ConstructorNonEmptyReturnTypeRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/CopyrightMissingRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/CopyrightMissingRuleTest.java b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/CopyrightMissingRuleTest.java
new file mode 100644
index 0000000..308224e
--- /dev/null
+++ b/FlexPMD/language-module/ruleset/ruleset-flex-basic/src/test/java/org/apache/flex/pmd/rules/style/CopyrightMissingRuleTest.java
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.style;
+
+import org.apache.flex.pmd.rules.AbstractFlexRuleTest;
+import org.apache.flex.pmd.rules.core.AbstractFlexRule;
+import org.apache.flex.pmd.rules.core.ViolationPosition;
+
+public class CopyrightMissingRuleTest extends AbstractFlexRuleTest {
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles() {
+ return new ExpectedViolation[]
+ {new ExpectedViolation("Simple.as", new ViolationPosition[]
+ {new ViolationPosition(-1)}),
+ new ExpectedViolation("MainWithNoCopyright.mxml", new ViolationPosition[]
+ {new ViolationPosition(-1)})};
+ }
+
+ @Override
+ protected AbstractFlexRule getRule() {
+ return new CopyrightMissingRule();
+ }
+}