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:07 UTC
[08/46] FlexPMD Donation from Adobe Systems Inc
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/AllowInsecureDomainRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/AllowInsecureDomainRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/AllowInsecureDomainRuleTest.java
new file mode 100644
index 0000000..b802bf5
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/AllowInsecureDomainRuleTest.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 com.adobe.ac.pmd.rules.security;
+
+import com.adobe.ac.pmd.rules.core.AbstractRegExpBasedRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule;
+import com.adobe.ac.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( 39 ),
+ new ViolationPosition( 40 ) } ) };
+ }
+
+ @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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/ImportLoadBestPracticeRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/ImportLoadBestPracticeRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/ImportLoadBestPracticeRuleTest.java
new file mode 100644
index 0000000..7718c24
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/ImportLoadBestPracticeRuleTest.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 com.adobe.ac.pmd.rules.security;
+
+import com.adobe.ac.pmd.rules.core.AbstractRegExpBasedRuleTest;
+import com.adobe.ac.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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/InsecureExactSettingsRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/InsecureExactSettingsRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/InsecureExactSettingsRuleTest.java
new file mode 100644
index 0000000..ef80bbd
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/InsecureExactSettingsRuleTest.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 com.adobe.ac.pmd.rules.security;
+
+import com.adobe.ac.pmd.rules.core.AbstractRegExpBasedRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule;
+import com.adobe.ac.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( 41 ) } ) };
+ }
+
+ @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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/LSOSecureFalseRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/LSOSecureFalseRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/LSOSecureFalseRuleTest.java
new file mode 100644
index 0000000..83a35c6
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/LSOSecureFalseRuleTest.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.security;
+
+import com.adobe.ac.pmd.rules.core.AbstractRegExpBasedRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule;
+import com.adobe.ac.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( 45 ) } ) };
+ }
+
+ @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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/LocalConnectionStarRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/LocalConnectionStarRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/LocalConnectionStarRuleTest.java
new file mode 100644
index 0000000..97adaf7
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/security/LocalConnectionStarRuleTest.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.security;
+
+import com.adobe.ac.pmd.rules.core.AbstractRegExpBasedRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule;
+import com.adobe.ac.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( 42 ) } ) };
+ }
+
+ @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/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooLongFunctionRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooLongFunctionRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooLongFunctionRuleTest.java
new file mode 100644
index 0000000..d6fc009
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooLongFunctionRuleTest.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.sizing;
+
+import java.util.LinkedHashMap;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+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( 97 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.NestedSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 35 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.LongSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 39 ) } ),
+ new ExpectedViolation( "ErrorToltipSkin.as", new ViolationPosition[]
+ { new ViolationPosition( 156 ) } ),
+ new ExpectedViolation( "PngEncoder.as", new ViolationPosition[]
+ { new ViolationPosition( 150 ),
+ new ViolationPosition( 335 ),
+ new ViolationPosition( 548 ) } ),
+ new ExpectedViolation( "RadonDataGrid.as", new ViolationPosition[]
+ { new ViolationPosition( 84 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new TooLongFunctionRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooLongSwitchCaseRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooLongSwitchCaseRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooLongSwitchCaseRuleTest.java
new file mode 100644
index 0000000..1695b38
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooLongSwitchCaseRuleTest.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 com.adobe.ac.pmd.rules.sizing;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class TooLongSwitchCaseRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "ErrorToltipSkin.as", new ViolationPosition[]
+ { new ViolationPosition( 189 ),
+ new ViolationPosition( 214 ),
+ new ViolationPosition( 252 ),
+ new ViolationPosition( 290 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.NestedSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 38 ),
+ new ViolationPosition( 58 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.LongSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 47 ),
+ new ViolationPosition( 52 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new TooLongSwitchCaseRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFieldInVORuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFieldInVORuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFieldInVORuleTest.java
new file mode 100644
index 0000000..7d53b3a
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFieldInVORuleTest.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 com.adobe.ac.pmd.rules.sizing;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.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( 33 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new TooManyFieldInVORule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFieldsRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFieldsRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFieldsRuleTest.java
new file mode 100644
index 0000000..b8b9e19
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFieldsRuleTest.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 com.adobe.ac.pmd.rules.sizing;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.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( 46 ) } ),
+ new ExpectedViolation( "Sorted.as", new ViolationPosition[]
+ { new ViolationPosition( 37 ) } ),
+ new ExpectedViolation( "PngEncoder.as", new ViolationPosition[]
+ { new ViolationPosition( 42 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.BigModel.as", new ViolationPosition[]
+ { new ViolationPosition( 35 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new TooManyFieldsRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFunctionRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFunctionRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFunctionRuleTest.java
new file mode 100644
index 0000000..72176ba
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyFunctionRuleTest.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 com.adobe.ac.pmd.rules.sizing;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class TooManyFunctionRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "PngEncoder.as", new ViolationPosition[]
+ { new ViolationPosition( 42 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.TestResult.as", new ViolationPosition[]
+ { new ViolationPosition( 46 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.BigModel.as", new ViolationPosition[]
+ { new ViolationPosition( 35 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new TooManyFunctionRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyParametersRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyParametersRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyParametersRuleTest.java
new file mode 100644
index 0000000..4073258
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyParametersRuleTest.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 com.adobe.ac.pmd.rules.sizing;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class TooManyParametersRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "RadonDataGrid.as", new ViolationPosition[]
+ { new ViolationPosition( 68 ),
+ new ViolationPosition( 84 ),
+ new ViolationPosition( 117 ) } ),
+ new ExpectedViolation( "PngEncoder.as", new ViolationPosition[]
+ { new ViolationPosition( 548 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.BigImporterModel.as", new ViolationPosition[]
+ { new ViolationPosition( 62 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new TooManyParametersRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyPublicRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyPublicRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyPublicRuleTest.java
new file mode 100644
index 0000000..7e54083
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/sizing/TooManyPublicRuleTest.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 com.adobe.ac.pmd.rules.sizing;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.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( 33 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.TestResult.as", new ViolationPosition[]
+ { new ViolationPosition( 46 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.BigModel.as", new ViolationPosition[]
+ { new ViolationPosition( 35 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new TooManyPublicRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/BadFormatLoggerRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/BadFormatLoggerRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/BadFormatLoggerRuleTest.java
new file mode 100644
index 0000000..ff43207
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/BadFormatLoggerRuleTest.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 com.adobe.ac.pmd.rules.style;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class BadFormatLoggerRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "AbstractRowData.as", new ViolationPosition[]
+ { new ViolationPosition( 44 ),
+ new ViolationPosition( 45 ),
+ new ViolationPosition( 46 ),
+ new ViolationPosition( 47 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new BadFormatLoggerRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/ConstructorNonEmptyReturnTypeRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/ConstructorNonEmptyReturnTypeRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/ConstructorNonEmptyReturnTypeRuleTest.java
new file mode 100644
index 0000000..629461d
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/ConstructorNonEmptyReturnTypeRuleTest.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 com.adobe.ac.pmd.rules.style;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.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( 37 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new ConstructorNonEmptyReturnTypeRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/CopyrightMissingRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/CopyrightMissingRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/CopyrightMissingRuleTest.java
new file mode 100644
index 0000000..b84a603
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/CopyrightMissingRuleTest.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 com.adobe.ac.pmd.rules.style;
+
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRuleTest;
+import com.adobe.ac.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();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/ImportFromSamePackageRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/ImportFromSamePackageRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/ImportFromSamePackageRuleTest.java
new file mode 100644
index 0000000..2c3f3de
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/ImportFromSamePackageRuleTest.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 com.adobe.ac.pmd.rules.style;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class ImportFromSamePackageRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "com.adobe.ac.ncss.BigImporterModel.as", new ViolationPosition[]
+ { new ViolationPosition( 33 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new ImportFromSamePackageRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/OverLongLineRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/OverLongLineRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/OverLongLineRuleTest.java
new file mode 100644
index 0000000..12155e3
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/OverLongLineRuleTest.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 com.adobe.ac.pmd.rules.style;
+
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class OverLongLineRuleTest extends AbstractFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "RadonDataGrid.as", new ViolationPosition[]
+ { new ViolationPosition( 68 ),
+ new ViolationPosition( 84 ),
+ new ViolationPosition( 117 ) } ),
+ new ExpectedViolation( "Simple.as", new ViolationPosition[]
+ { new ViolationPosition( 1 ) } ),
+ new ExpectedViolation( "FileReferenceList.as", new ViolationPosition[]
+ { new ViolationPosition( 47 ) } ),
+ new ExpectedViolation( "AbstractRowData.as", new ViolationPosition[]
+ { new ViolationPosition( 46 ),
+ new ViolationPosition( 47 ),
+ new ViolationPosition( 49 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.BigImporterModel.as", new ViolationPosition[]
+ { new ViolationPosition( 62 ) } ),
+ new ExpectedViolation( "SkinStyles.as", new ViolationPosition[]
+ { new ViolationPosition( 82 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.mxml.IterationsList2.mxml",
+ new ViolationPosition[]
+ { new ViolationPosition( 54 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new OverLongLineRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/TabUsedAsIndentorRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/TabUsedAsIndentorRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/TabUsedAsIndentorRuleTest.java
new file mode 100644
index 0000000..598ee2e
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/style/TabUsedAsIndentorRuleTest.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.style;
+
+import java.io.File;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.logging.Logger;
+
+import net.sourceforge.pmd.PMDException;
+
+import com.adobe.ac.pmd.files.impl.FileUtils;
+import com.adobe.ac.pmd.rules.core.AbstractRegExpBasedRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractRegexpBasedRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class TabUsedAsIndentorRuleTest extends AbstractRegExpBasedRuleTest
+{
+ private static final Logger LOGGER = Logger.getLogger( TabUsedAsIndentorRuleTest.class.getName() );
+ private final String TEST_FOLDER = "/com/adobe/ac/ncss/event";
+
+ public TabUsedAsIndentorRuleTest()
+ {
+ super();
+ final URL resource = this.getClass().getResource( "/test"
+ + TEST_FOLDER );
+
+ if ( resource != null )
+ {
+ try
+ {
+ setTestFiles( FileUtils.computeFilesList( new File( resource.toURI().getPath() ),
+ null,
+ "",
+ null ) );
+ }
+ catch ( final PMDException e )
+ {
+ LOGGER.warning( e.getLocalizedMessage() );
+ }
+ catch ( final URISyntaxException e )
+ {
+ LOGGER.warning( e.getLocalizedMessage() );
+ }
+ }
+ }
+
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "SecondCustomEvent.as", new ViolationPosition[]
+ { new ViolationPosition( 37 ) } ) };
+ }
+
+ @Override
+ protected String[] getMatchableLines()
+ {
+ return new String[]
+ { "\t",
+ " \t\t",
+ " \t " };
+ }
+
+ @Override
+ protected AbstractRegexpBasedRule getRegexpBasedRule()
+ {
+ return new TabUsedAsIndentorRule();
+ }
+
+ @Override
+ protected File getTestDirectory() // NO_UCD
+ {
+ return new File( super.getTestDirectory().getAbsolutePath()
+ + TEST_FOLDER );
+ }
+
+ @Override
+ protected String[] getUnmatchableLines()
+ {
+ return new String[]
+ { " ",
+ "lala\t\t" };
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/IdenticalSwitchCasesRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/IdenticalSwitchCasesRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/IdenticalSwitchCasesRuleTest.java
new file mode 100644
index 0000000..12b860e
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/IdenticalSwitchCasesRuleTest.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 com.adobe.ac.pmd.rules.switchrules;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class IdenticalSwitchCasesRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "com.adobe.ac.ncss.LongSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 58 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new IdenticalSwitchCasesRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NestedSwitchRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NestedSwitchRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NestedSwitchRuleTest.java
new file mode 100644
index 0000000..be995c4
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NestedSwitchRuleTest.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 com.adobe.ac.pmd.rules.switchrules;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class NestedSwitchRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "com.adobe.ac.ncss.LongSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 53 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.NestedSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 43 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new NestedSwitchRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NonBreakableSwitchCaseRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NonBreakableSwitchCaseRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NonBreakableSwitchCaseRuleTest.java
new file mode 100644
index 0000000..e6ec6de
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NonBreakableSwitchCaseRuleTest.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 com.adobe.ac.pmd.rules.switchrules;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class NonBreakableSwitchCaseRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "com.adobe.ac.ncss.LongSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 134 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new NonBreakableSwitchCaseRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/SwitchStatementsShouldHaveDefaultRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/SwitchStatementsShouldHaveDefaultRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/SwitchStatementsShouldHaveDefaultRuleTest.java
new file mode 100644
index 0000000..e581a14
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/SwitchStatementsShouldHaveDefaultRuleTest.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 com.adobe.ac.pmd.rules.switchrules;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class SwitchStatementsShouldHaveDefaultRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "com.adobe.ac.ncss.LongSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 53 ),
+ new ViolationPosition( 41 ),
+ new ViolationPosition( 92 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.NestedSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 43 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new SwitchStatementsShouldHaveDefaultRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/TooFewBrancheInSwitchStatementRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/TooFewBrancheInSwitchStatementRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/TooFewBrancheInSwitchStatementRuleTest.java
new file mode 100644
index 0000000..060a151
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/TooFewBrancheInSwitchStatementRuleTest.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 com.adobe.ac.pmd.rules.switchrules;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class TooFewBrancheInSwitchStatementRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "com.adobe.ac.ncss.LongSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 53 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.NestedSwitch.as", new ViolationPosition[]
+ { new ViolationPosition( 43 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new TooFewBrancheInSwitchStatementRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/EmptyPrivateMethodRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/EmptyPrivateMethodRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/EmptyPrivateMethodRuleTest.java
new file mode 100644
index 0000000..4ce2bfc
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/EmptyPrivateMethodRuleTest.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.unused;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class EmptyPrivateMethodRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "bug.FlexPMD97.as", new ViolationPosition[]
+ { new ViolationPosition( 39 ) } ),
+ new ExpectedViolation( "Sorted.as", new ViolationPosition[]
+ { new ViolationPosition( 62 ),
+ new ViolationPosition( 71 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.BigModel.as", new ViolationPosition[]
+ { new ViolationPosition( 82 ),
+ new ViolationPosition( 86 ),
+ new ViolationPosition( 90 ),
+ new ViolationPosition( 94 ),
+ new ViolationPosition( 98 ) } ),
+ new ExpectedViolation( "cairngorm.events.CorrectConstantEvent.as", new ViolationPosition[]
+ { new ViolationPosition( 53 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new EmptyPrivateMethodRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedFieldRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedFieldRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedFieldRuleTest.java
new file mode 100644
index 0000000..d106a07
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedFieldRuleTest.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 com.adobe.ac.pmd.rules.unused;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class UnusedFieldRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "Responder.as", new ViolationPosition[]
+ { new ViolationPosition( 37 ) } ),
+ new ExpectedViolation( "Sorted.as", new ViolationPosition[]
+ { new ViolationPosition( 54 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.BigModel.as", new ViolationPosition[]
+ { new ViolationPosition( 42 ) } ),
+ new ExpectedViolation( "Title.as", new ViolationPosition[]
+ { new ViolationPosition( 41 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new UnusedFieldRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedLocalVariableRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedLocalVariableRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedLocalVariableRuleTest.java
new file mode 100644
index 0000000..c18fc9d
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedLocalVariableRuleTest.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.unused;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class UnusedLocalVariableRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "src.epg.StateExit_AS2.as", new ViolationPosition[]
+ { new ViolationPosition( 62 ),
+ new ViolationPosition( 63 ),
+ new ViolationPosition( 67 ),
+ new ViolationPosition( 68 ),
+ new ViolationPosition( 69 ),
+ new ViolationPosition( 70 ),
+ new ViolationPosition( 71 ),
+ new ViolationPosition( 72 ),
+ new ViolationPosition( 73 ),
+ new ViolationPosition( 74 ),
+ new ViolationPosition( 75 ),
+ new ViolationPosition( 76 ),
+ new ViolationPosition( 77 ) } ),
+ new ExpectedViolation( "DeleteButtonRenderer.mxml", new ViolationPosition[]
+ { new ViolationPosition( 69 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.VoidConstructor.as", new ViolationPosition[]
+ { new ViolationPosition( 40 ) } ),
+ new ExpectedViolation( "RadonDataGrid.as", new ViolationPosition[]
+ { new ViolationPosition( 100 ),
+ new ViolationPosition( 101 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.BigModel.as", new ViolationPosition[]
+ { new ViolationPosition( 47 ) } ),
+ new ExpectedViolation( "UnboundMetadata.as", new ViolationPosition[]
+ { new ViolationPosition( 50 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.BigImporterModel.as", new ViolationPosition[]
+ { new ViolationPosition( 64 ) } ),
+ new ExpectedViolation( "GenericType.as", new ViolationPosition[]
+ { new ViolationPosition( 46 ) } ),
+ new ExpectedViolation( "ErrorToltipSkin.as", new ViolationPosition[]
+ { new ViolationPosition( 163 ),
+ new ViolationPosition( 165 ),
+ new ViolationPosition( 166 ),
+ new ViolationPosition( 183 ),
+ new ViolationPosition( 184 ) } ),
+ new ExpectedViolation( "bug.Duane.mxml", new ViolationPosition[]
+ { new ViolationPosition( 68 ) } ),
+ new ExpectedViolation( "bug.FlexPMD88.as", new ViolationPosition[]
+ { new ViolationPosition( 42 ),
+ new ViolationPosition( 43 ),
+ new ViolationPosition( 44 ),
+ new ViolationPosition( 45 ) } ),
+ new ExpectedViolation( "flexpmd114.a.Test.as", new ViolationPosition[]
+ { new ViolationPosition( 42 ) } ),
+ new ExpectedViolation( "flexpmd114.b.Test.as", new ViolationPosition[]
+ { new ViolationPosition( 42 ) } ),
+ new ExpectedViolation( "flexpmd114.c.Test.as", new ViolationPosition[]
+ { new ViolationPosition( 42 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new UnusedLocalVariableRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedParameterRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedParameterRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedParameterRuleTest.java
new file mode 100644
index 0000000..74660db
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedParameterRuleTest.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.unused;
+
+import java.util.LinkedHashMap;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class UnusedParameterRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ new LinkedHashMap< String, ViolationPosition[] >();
+
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "FileReferenceList.as", new ViolationPosition[]
+ { new ViolationPosition( 70 ) } ),
+ new ExpectedViolation( "cairngorm.NonBindableModelLocator.as", new ViolationPosition[]
+ { new ViolationPosition( 43 ) } ),
+ new ExpectedViolation( "bug.FlexPMD232.as", new ViolationPosition[]
+ { new ViolationPosition( 35 ),
+ new ViolationPosition( 35 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.BigImporterModel.as", new ViolationPosition[]
+ { new ViolationPosition( 62 ),
+ new ViolationPosition( 62 ),
+ new ViolationPosition( 62 ) } ),
+ new ExpectedViolation( "Sorted.as", new ViolationPosition[]
+ { new ViolationPosition( 67 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new UnusedParameterRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedPrivateMethodRuleTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedPrivateMethodRuleTest.java b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedPrivateMethodRuleTest.java
new file mode 100644
index 0000000..a2c9f5c
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedPrivateMethodRuleTest.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.unused;
+
+import com.adobe.ac.pmd.rules.core.AbstractAstFlexRuleTest;
+import com.adobe.ac.pmd.rules.core.AbstractFlexRule;
+import com.adobe.ac.pmd.rules.core.ViolationPosition;
+
+public class UnusedPrivateMethodRuleTest extends AbstractAstFlexRuleTest
+{
+ @Override
+ protected ExpectedViolation[] getExpectedViolatingFiles()
+ {
+ return new ExpectedViolation[]
+ { new ExpectedViolation( "bug.Duane.mxml", new ViolationPosition[]
+ { new ViolationPosition( 66 ) } ),
+ new ExpectedViolation( "Sorted.as", new ViolationPosition[]
+ { new ViolationPosition( 71 ) } ),
+ new ExpectedViolation( "cairngorm.LightController.as", new ViolationPosition[]
+ { new ViolationPosition( 191 ) } ),
+ new ExpectedViolation( "RadonDataGrid.as", new ViolationPosition[]
+ { new ViolationPosition( 207 ) } ),
+ new ExpectedViolation( "com.adobe.ac.ncss.BigModel.as", new ViolationPosition[]
+ { new ViolationPosition( 86 ),
+ new ViolationPosition( 90 ),
+ new ViolationPosition( 94 ),
+ new ViolationPosition( 98 ) } ) };
+ }
+
+ @Override
+ protected AbstractFlexRule getRule()
+ {
+ return new UnusedPrivateMethodRule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-test-resources/pom.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-test-resources/pom.xml b/FlexPMD/flex-pmd-test-resources/pom.xml
new file mode 100644
index 0000000..d4f3af0
--- /dev/null
+++ b/FlexPMD/flex-pmd-test-resources/pom.xml
@@ -0,0 +1,56 @@
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.adobe.ac</groupId>
+ <artifactId>flex-pmd-test-resources</artifactId>
+ <packaging>pom</packaging>
+ <name>Adobe Flex PMD RuleSet test resources</name>
+
+ <parent>
+ <groupId>com.adobe.ac</groupId>
+ <artifactId>flex-pmd-java-parent</artifactId>
+ <version>1.3-SNAPSHOT</version>
+ <relativePath>../flex-pmd-java-parent/pom.xml</relativePath>
+ </parent>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>make shared resources</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/resources.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-test-resources/src/main/assembly/resources.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-test-resources/src/main/assembly/resources.xml b/FlexPMD/flex-pmd-test-resources/src/main/assembly/resources.xml
new file mode 100644
index 0000000..e3287ee
--- /dev/null
+++ b/FlexPMD/flex-pmd-test-resources/src/main/assembly/resources.xml
@@ -0,0 +1,31 @@
+<!--
+
+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.
+
+-->
+<assembly>
+ <id>resources</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+</assembly>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.as
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.as b/FlexPMD/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.as
new file mode 100644
index 0000000..bbf54ce
--- /dev/null
+++ b/FlexPMD/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.as
@@ -0,0 +1,136 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 flexUnit.flexui.data
+{
+ import flexunit.flexui.controls.FlexUnitLabelsModelLocator;
+
+ import mx.binding.utils.ChangeWatcher;
+ import mx.formatters.NumberFormatter;
+
+ /**
+ * Abstract class representing a row in the test cases tree.
+ * A row can be either a test class (node) or a test case (leaf)
+ */
+ final public class AbstractRowData
+ {
+ protected var logger : ILogger;
+ public const logger : ILogger;
+ public const logger : ILogger = Log.getLogger( "flexUnit.flexui.data.AbstractRowData" );
+ public const LOGGER : ILogger = Log.getLogger( "flexUnit.flexui.data.AbstractRowData" );
+ public const LOG : ILogger = Log.getLogger( "flexUnit.AbstractRowData" );
+ public static const LOG : ILogger = Log.getLogger( "flexUnit.flexui.data.AbstractRowData" );
+ public const LOG : ILogger = Log.getLogger( "flexUnit.flexui.data.AbstractRowData" );
+ // public var testIsFailure : Boolean;
+ public var objectUse : Object;
+
+ /**
+ * @return the class name from the qualified class name
+ */
+ /*public function get className() : String
+ {
+ if ( qualifiedClassName )
+ {
+ var splitIndex : int = qualifiedClassName.lastIndexOf( "::" );
+
+ if ( splitIndex >= 0 )
+ {
+ return qualifiedClassName.substring( splitIndex + 2 );
+ }
+ }
+
+ return qualifiedClassName;
+ }*/
+
+ /**
+ * Abstract method. Defined in TestCaseRowData and in TestClassRowData
+ *
+ * @return the count of assertions which have been made either in average if
+ * the current row is a test class or in total if the current row is a test case
+ */
+ // One line comment
+ public function get assertionsMade() : Number
+ {
+ throw new Error( "TestSummaryRowData::assertionsMade is an abstract method" );
+ }
+
+ public function get failIcon() : Class
+ {
+ throw new Error( "TestSummaryRowData::failIcon is an abstract method" );
+ }
+
+ protected function get passIcon() : Class
+ {
+ throw new Error( "TestSummaryRowData::passIcon is an abstract method" );
+ }
+
+ /**
+ * Abstract method which allows the legend to be correctly formatted.
+ *
+ * @return true for the TestClassRowData and false for the TestCaseRowData
+ */
+ public function get isAverage() : Boolean
+ {
+ throw new Error( "TestSummaryRowData::isAverage is an abstract method" );
+ }
+
+ public function get formattedAssertionsMade() : String
+ {
+ if(true)
+ {
+ }
+ addEventListener("lalaEvent");
+ CairngormEventDispatcher.getInstance().dispatchEvent(new Event("lalaEvent"));
+ dispatchEvent( new Event( "lalaEvent" ) );
+ dispatchEvent( new Event( EVENT ) );
+ if( true );
+ CairngormEventDispatcher.getInstance().addEventListener(CONSTANT, onHearing);
+ return f.format( assertionsMade );
+ }
+
+ /**
+ * @return the correcly formatted (no typos) legend for the number of assertions
+ * made.
+ *
+ * Can return :
+ * - 0 assertions have been made in average
+ * - 0 assertions have been made in total
+ * - 1 assertion has been made in average
+ * - 1 assertion has been made in total
+ * - 2 assertions have been made in average
+ * - 2 assertions have been made in total
+ */
+ public function get assertionsMadeLegend() : String
+ {
+ return FlexUnitLabels.formatAssertions(
+ formattedAssertionsMade,
+ assertionsMade,
+ isAverage );
+ }
+
+ override protected function createChildren() : void
+ {
+ super.createChildren();
+ }
+
+ override protected function updateDisplayList( width : int, height : int ) : void
+ {
+ super.updateDisplayList( width * 2, height );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.mxml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.mxml b/FlexPMD/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.mxml
new file mode 100644
index 0000000..c31373b
--- /dev/null
+++ b/FlexPMD/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.mxml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
+ xmlns="*">
+
+ <mx:Script>
+ <![CDATA[
+ public override function closePopup() : void
+ {
+ if ( useWithPopUpWrapper )
+ {
+ dispatchEvent( new Event( CLOSE_POPUP_EVENT ) );
+ } else
+ {
+ super.closePopup( event );
+ }
+ }
+ ]]>
+ </mx:Script>
+
+ <mx:Script>
+ <![CDATA[
+
+ ]]>
+ </mx:Script>
+
+</mx:Application>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-test-resources/src/main/resources/test/BadComponent.as
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-test-resources/src/main/resources/test/BadComponent.as b/FlexPMD/flex-pmd-test-resources/src/main/resources/test/BadComponent.as
new file mode 100644
index 0000000..f45be51
--- /dev/null
+++ b/FlexPMD/flex-pmd-test-resources/src/main/resources/test/BadComponent.as
@@ -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 com.adobe.ac.pmd.view
+{
+ import mx.controls.Label;
+ import mx.core.UIComponent;
+
+ public class BadComponent extends UIComponent
+ {
+ override protected function updateDisplayList( w : Number, h : Number ) : void
+ {
+ super.updateDisplayList( w, h );
+
+ addChild( new Label() );
+ addChildAt( new Label() );
+ removeChild( new Label() );
+ removeChildAt( 0 );
+ }
+
+ override protected function createChildren() : void
+ {
+ super.createChildren();
+
+ addMyChildren();
+ }
+ }
+}
\ No newline at end of file