http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/IdenticalSwitchCasesRuleTest.java ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/IdenticalSwitchCasesRuleTest.java b/FlexPMD/flex-pmd-java/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-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NestedSwitchRuleTest.java ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NestedSwitchRuleTest.java b/FlexPMD/flex-pmd-java/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-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NonBreakableSwitchCaseRuleTest.java ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/NonBreakableSwitchCaseRuleTest.java b/FlexPMD/flex-pmd-java/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-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/SwitchStatementsShouldHaveDefaultRuleTest.java ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/SwitchStatementsShouldHaveDefaultRuleTest.java b/FlexPMD/flex-pmd-java/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-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/TooFewBrancheInSwitchStatementRuleTest.java ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/switchrules/TooFewBrancheInSwitchStatementRuleTest.java b/FlexPMD/flex-pmd-java/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-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/EmptyPrivateMethodRuleTest.java ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/EmptyPrivateMethodRuleTest.java b/FlexPMD/flex-pmd-java/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-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedFieldRuleTest.java ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedFieldRuleTest.java b/FlexPMD/flex-pmd-java/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-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedLocalVariableRuleTest.java ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedLocalVariableRuleTest.java b/FlexPMD/flex-pmd-java/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-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedParameterRuleTest.java ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedParameterRuleTest.java b/FlexPMD/flex-pmd-java/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-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedPrivateMethodRuleTest.java ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset/src/test/java/com/adobe/ac/pmd/rules/unused/UnusedPrivateMethodRuleTest.java b/FlexPMD/flex-pmd-java/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-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/pom.xml ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/pom.xml b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/pom.xml new file mode 100644 index 0000000..f1b8a78 --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/pom.xml @@ -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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.flex.pmd</groupId> + <artifactId>flex-pmd-java</artifactId> + <version>1.3-SNAPSHOT</version> + </parent> + + <artifactId>flex-pmd-test-resources</artifactId> + <packaging>pom</packaging> + + <name>Adobe Flex PMD RuleSet test resources</name> + + <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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/assembly/resources.xml ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/assembly/resources.xml b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/assembly/resources.xml new file mode 100644 index 0000000..e3287ee --- /dev/null +++ b/FlexPMD/flex-pmd-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.as ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.as b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.as new file mode 100644 index 0000000..bbf54ce --- /dev/null +++ b/FlexPMD/flex-pmd-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.mxml ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.mxml b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/AbstractRowData.mxml new file mode 100644 index 0000000..c31373b --- /dev/null +++ b/FlexPMD/flex-pmd-java/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/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/BadComponent.as ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/BadComponent.as b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/BadComponent.as new file mode 100644 index 0000000..f45be51 --- /dev/null +++ b/FlexPMD/flex-pmd-java/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 http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Color.as ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Color.as b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Color.as new file mode 100644 index 0000000..aec4604 --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Color.as @@ -0,0 +1,29 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.colors + +{ + + public interface Color + + { + function foo() : void; + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/DefaultNameEvent.as ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/DefaultNameEvent.as b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/DefaultNameEvent.as new file mode 100644 index 0000000..6d95245 --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/DefaultNameEvent.as @@ -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 +{ + public class DefaultNameEvent extends Event + { + public static const DAY_CHANGE : String = "dayChange"; + public static const DELAYED_MIDNIGHT_REFRESH : String = "delayedMidnightRefresh"; + + public function DefaultNameEvent( type : String = "" ) + { + super( type ); + } + + override public function clone() : Event + { + return new DefaultNameEvent( type ); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/DeleteButtonRenderer.mxml ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/DeleteButtonRenderer.mxml b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/DeleteButtonRenderer.mxml new file mode 100644 index 0000000..ea6dfd4 --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/DeleteButtonRenderer.mxml @@ -0,0 +1,101 @@ +<?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:Button xmlns:mx="http://www.adobe.com/2006/mxml" + icon="@Embed(source='/assets/icon_tool_trash2.png')" + toolTip="Remove this rule ({ rule.shortName }) from your ruleset..." + skin="mx.skins.ProgrammaticSkin" + buttonMode="true" + click="onClick()" + mouseChildren="false" + useHandCursor="true" + > + + <mx:Metadata> + [Event(name="ruleRemoved", type="flash.events.Event")] + </mx:Metadata> + + <mx:Script> + <![CDATA[ + import com.adobe.ac.pmd.model.Rule; + + import mx.controls.AdvancedDataGrid; + import mx.controls.listClasses.ListBase; + import mx.events.FlexEvent; + import mx.events.ListEvent; + + public static const RULE_REMOVED : String = "ruleRemoved"; + + [Bindable] + private var rule : Rule; + + private var grid : AdvancedDataGrid; + + override public function set data( value : Object ) : void + { + super.data = value; + + rule = value as Rule; + var ith : int = -1 + +1 + ith++ + -- ith; + if ( grid ) + { + changeVisibility(); + } + } + + override protected function commitProperties() : void + { + super.commitProperties(); + + grid = AdvancedDataGrid( owner ); + visible = false; + grid.addEventListener( ListEvent.CHANGE, onChange ); + } + + private function changeVisibility() : void + { + visible = grid.isItemSelected( data ) && rule != null; + } + + private function onChange( event : ListEvent ) : void + { + changeVisibility(); + } + + private function onClick() : void + { + if ( rule ) + { + rule.remove(); + + dispatchEvent( new Event( RULE_REMOVED, true ) ); + } + } + ]]> + </mx:Script> + + <mx:states> + <mx:State/> + <mx:State/> + <mx:State/> + <mx:State/> + <mx:State/> + </mx:states> + +</mx:Button> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/ErrorToltipSkin.as ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/ErrorToltipSkin.as b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/ErrorToltipSkin.as new file mode 100644 index 0000000..e15d298 --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/ErrorToltipSkin.as @@ -0,0 +1,317 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.radon.core.skin +{ + + import flash.display.GradientType; + import flash.display.Graphics; + import flash.display.InterpolationMethod; + import flash.display.SpreadMethod; + import flash.filters.DropShadowFilter; + import flash.geom.Matrix; + + import mx.core.EdgeMetrics; + import mx.graphics.RectangularDropShadow; + import mx.skins.RectangularBorder; + + /** + * The skin for a ToolTip. + */ + public class ErrorToolTipSkin extends RectangularBorder + { + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * Constructor. + */ + public function ErrorToolTipSkin() + { + super(); + } + + //-------------------------------------------------------------------------- + // + // Variables + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + private var dropShadow:RectangularDropShadow; + + //-------------------------------------------------------------------------- + // + // Overridden properties + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // borderMetrics + //---------------------------------- + + /** + * @private + * Storage for the borderMetrics property. + */ + private var _borderMetrics:EdgeMetrics; + + /** + * @private + */ + override public function get borderMetrics():EdgeMetrics + { + if (_borderMetrics) + return _borderMetrics; + + var borderStyle:String = getStyle("borderStyle"); + switch (borderStyle) + { + case "errorTipRight": + { + _borderMetrics = new EdgeMetrics(15, 1, 3, 3); + break; + } + + case "errorTipAbove": + { + _borderMetrics = new EdgeMetrics(3, 1, 3, 15); + break; + } + + case "errorTipBelow": + { + _borderMetrics = new EdgeMetrics(3, 13, 3, 3); + break; + } + + default: // "toolTip" + { + _borderMetrics = new EdgeMetrics(3, 1, 3, 3); + break; + } + } + + return _borderMetrics; + } + + //-------------------------------------------------------------------------- + // + // Overridden methods + // + //-------------------------------------------------------------------------- + + /** + * @private + * If borderStyle may have changed, clear the cached border metrics. + */ + override public function styleChanged(styleProp:String):void + { + if (styleProp == "borderStyle" || + styleProp == "styleName" || + styleProp == null) + { + _borderMetrics = null; + } + + invalidateDisplayList(); + } + + /** + * @private + * Draw the background and border. + */ + override protected function updateDisplayList(w:Number, h:Number):void + { + super.updateDisplayList(w, h); + + var borderStyle:String = getStyle("borderStyle"); + var backgroundColor:uint = getStyle("backgroundColor"); + var backgroundAlpha:Number= getStyle("backgroundAlpha"); + var borderColor:uint = getStyle("borderColor"); + var cornerRadius:Number = getStyle("cornerRadius"); + var shadowColor:uint = getStyle("shadowColor"); + var shadowAlpha:Number = 0.1; + + var graphics:Graphics = graphics; + graphics.clear(); + + filters = []; + + var type:String = GradientType.LINEAR; + var colors:Array = [0xff8300, 0xff4200]; + var alphas:Array = [1, 1]; + var ratios:Array = [0, 125 ]; + var spreadMethod:String = SpreadMethod.PAD; + var interp:String = InterpolationMethod.RGB; + var focalPtRatio:Number = 0; + + var matrix:Matrix = new Matrix(); + var boxRotation:Number = Math.PI/2; // 90ÃÅ¡ + var txx:Number = 0; + var tyy:Number = 0; + + switch (borderStyle) + { + case "toolTip": + { + // face + drawRoundRect( + 3, 1, w - 6, h - 4, cornerRadius, + backgroundColor, backgroundAlpha) + + if (!dropShadow) + dropShadow = new RectangularDropShadow(); + + dropShadow.distance = 3; + dropShadow.angle = 90; + dropShadow.color = 0; + dropShadow.alpha = 0.4; + + dropShadow.tlRadius = cornerRadius + 2; + dropShadow.trRadius = cornerRadius + 2; + dropShadow.blRadius = cornerRadius + 2; + dropShadow.brRadius = cornerRadius + 2; + + dropShadow.drawShadow(graphics, 3, 0, w - 6, h - 4); + + break; + } + + case "errorTipRight": + { + // border + matrix.createGradientBox(w - 11, h - 2, boxRotation, tx, ty); + graphics.beginGradientFill( + type, + colors, + alphas, + ratios, + matrix, + spreadMethod, + interp, + focalPtRatio); + + drawRoundRect( + 11, 0, w - 11, h - 2, 0 ); + + // left pointer + graphics.beginGradientFill( + type, + colors, + alphas, + ratios, + matrix, + spreadMethod, + interp, + focalPtRatio); + + graphics.moveTo(11, 7); + graphics.lineTo(0, 13); + graphics.lineTo(11, 19); + graphics.moveTo(11, 7); + graphics.endFill(); + + filters = [ new DropShadowFilter(2, 90, 0, 0.4) ]; + break; + } + + case "errorTipAbove": + { + // border + matrix.createGradientBox(w, h - 13, boxRotation, tx, ty); + graphics.beginGradientFill( + type, + colors, + alphas, + ratios, + matrix, + spreadMethod, + interp, + focalPtRatio); + + drawRoundRect( + 0, 0, w, h - 13, 0 ); + + // bottom pointer + graphics.beginGradientFill( + type, + colors, + alphas, + ratios, + matrix, + spreadMethod, + interp, + focalPtRatio); + + graphics.moveTo(9, h - 13); + graphics.lineTo(15, h - 2); + graphics.lineTo(21, h - 13); + graphics.moveTo(9, h - 13); + graphics.endFill(); + + filters = [ new DropShadowFilter(2, 90, 0, 0.4) ]; + break; + } + + case "errorTipBelow": + { + // border + matrix.createGradientBox(w, h - 13, boxRotation, tx, ty); + graphics.beginGradientFill( + type, + colors, + alphas, + ratios, + matrix, + spreadMethod, + interp, + focalPtRatio); + + drawRoundRect( + 0, 11, w, h - 13, 0 ); + + // top pointer + graphics.beginGradientFill( + type, + colors, + alphas, + ratios, + matrix, + spreadMethod, + interp, + focalPtRatio); + + graphics.moveTo(9, 11); + graphics.lineTo(15, 0); + graphics.lineTo(21, 11); + graphics.moveTo(10, 11); + graphics.endFill(); + + filters = [ new DropShadowFilter(2, 90, 0, 0.4) ]; + break; + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/GenericType.as ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/GenericType.as b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/GenericType.as new file mode 100644 index 0000000..94d42f5 --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/GenericType.as @@ -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 flexUnit.flexui.data +{ + public class GenericType extends com.adobe.ac.GenericType + { + public var logger : *; + public const logger : *; + public static const LOG : * = Log.getLogger( "flexUnit.flexui.data.AbstractRowData" ); + + public function get assertionsMade() : * + { + callLater( assertionsMadeLegend, [ null ] ); + } + + public override function set assertionsMadeLegend( fooBar : * ) : void + { + var tmp : * = new Object(); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/GoodComponent.as ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/GoodComponent.as b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/GoodComponent.as new file mode 100644 index 0000000..520cb20 --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/GoodComponent.as @@ -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 com.adobe.ac.pmd.view +{ + import mx.controls.Label; + import mx.core.UIComponent; + + public class GoodComponent extends UIComponent + { + override protected function updateDisplayList( w : Number, h : Number ) : void + { + super.updateDisplayList( w, h ); + } + + override protected function createChildren() : void + { + super.createChildren(); + + addChild( new Label() ); + addChildAt( new Label() ); + removeChild( new Label() ); + removeChildAt( 0 ); + + var myDirect : MyObject; + + with( myDirect ) + { + i = ""; + } + StyleManaer.loadStyles( something, false ); + StyleManager.loadStyles( something ); + StyleManager.loadStyles( something, true ); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/LinkButtonExample_Exception.mxml ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/LinkButtonExample_Exception.mxml b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/LinkButtonExample_Exception.mxml new file mode 100644 index 0000000..67509df --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/LinkButtonExample_Exception.mxml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- + + 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. + +--> +<!-- Simple example to demonstrate the LinkButton control. --> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> + + <mx:Script> + import mx.controls.Alert; + </mx:Script> + + <mx:Panel title="LinkButton Control Example" + height="75%" width="75%" horizontalAlign="center" + paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"> + + <mx:Label width="100%" + text="Select the LinkButton control to open the Alert control."/> + + <mx:LinkButton label="LinkButton control" color="#0000FF" fontWeight="bold" + click="Alert.show('LinkButton selected!');"/> + + </mx:Panel> +</mx:Application> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Looping.as ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Looping.as b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Looping.as new file mode 100644 index 0000000..75161a9 --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Looping.as @@ -0,0 +1,68 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package +{ + import com.model.VO.ConfigVO; + + import de.polygonal.ds.HashMap; + + public class Looping + { + public function Looping() + { + for ( var i : int = 0; i < 10; i++ ) + { + new Foo(); + while( true ) + { + new Object(); + } + for each ( var i : Object in list ) + { + new Object(); + } + } + new Object(); + for each ( var i : Object in list ) + { + new Foo(); + while( true ) + { + new Object(); + } + for each ( var i : Object in list ) + { + var o : Object = new Object(); + } + } + while( true ) + { + new Foo(); + while( true ) + { + new Object(); + } + for each ( var i : Object in list ) + { + new Object(); + } + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Main.mxml ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Main.mxml b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Main.mxml new file mode 100644 index 0000000..119e4c9 --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/Main.mxml @@ -0,0 +1,45 @@ +<?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:lcds="com.adobe.ac.lcds.*" + xmlns:mx="http://www.adobe.com/2006/mxml" + creationPolicy="all" + backgroundColor="#E57000" + horizontalAlign="left" + creationComplete="ds.fill(products, 'all')" + addedToStage="callLater( myFunction )" + xmlns="*"> + + <mx:Script> + <![CDATA[ + import mx.data.mxml.DataService; + import mx.data.events.DataConflictEvent; + import mx.data.Conflicts; + import mx.data.Conflict; + ]]> + </mx:Script> + + <mx:Style> +.myStyle +{ +} + </mx:Style> + + <mx:Script source="myCodeBehind.as"/> +</mx:Application> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/MainWithModelLocator.mxml ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/MainWithModelLocator.mxml b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/MainWithModelLocator.mxml new file mode 100644 index 0000000..dbf8840 --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/MainWithModelLocator.mxml @@ -0,0 +1,42 @@ +<?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="*" + backgroundColor="#E57000" horizontalAlign="left" + creationComplete="ds.fill(products, 'all')" xmlns:lcds="com.adobe.ac.lcds.*"> + + <mx:Script> + <![CDATA[ + import mx.data.mxml.DataService; + + import com.adobe.ac.MyModelLocator; + import mx.data.events.DataConflictEvent; + import mx.data.Conflicts; + import mx.data.Conflict; + import mx.controls.Alert; + ]]> + </mx:Script> + + <mx:Style source="my.css"/> + + <mx:Style + source="my.css" + /> + +</mx:Application> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/MainWithNoCopyright.mxml ---------------------------------------------------------------------- diff --git a/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/MainWithNoCopyright.mxml b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/MainWithNoCopyright.mxml new file mode 100644 index 0000000..1baa53d --- /dev/null +++ b/FlexPMD/flex-pmd-java/flex-pmd-test-resources/src/main/resources/test/MainWithNoCopyright.mxml @@ -0,0 +1,22 @@ +<?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:Application> \ No newline at end of file