You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2014/08/27 00:43:49 UTC
[18/51] [partial] Refactored the PMD Maven build - Adjusted the
directory structure - Fixed a lot of compile problems - Fixed the maven setup
- Made PMD build with Flexmojos 7.1.0 and Apache Flex 4.13.0 - Fixed a few
UnitTests
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/AbstractMetrics.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/AbstractMetrics.java b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/AbstractMetrics.java
new file mode 100644
index 0000000..53e4fec
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/AbstractMetrics.java
@@ -0,0 +1,234 @@
+/*
+ * 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.metrics.engine;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.logging.Logger;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.XMLWriter;
+
+import com.adobe.ac.ncss.filters.FlexFilter;
+import com.adobe.ac.pmd.metrics.ClassMetrics;
+import com.adobe.ac.pmd.metrics.FunctionMetrics;
+import com.adobe.ac.pmd.metrics.PackageMetrics;
+import com.adobe.ac.pmd.metrics.ProjectMetrics;
+
+public abstract class AbstractMetrics
+{
+ private static class DirectoryFilter implements FileFilter
+ {
+ public boolean accept( final File file )
+ {
+ return file.isDirectory();
+ }
+ }
+
+ private static final Logger LOGGER = Logger.getLogger( AbstractMetrics.class.getName() );
+
+ private static Collection< File > listFiles( final File directory,
+ final FilenameFilter filter,
+ final boolean recurse )
+ {
+ final Collection< File > files = new ArrayList< File >();
+ final File[] entries = directory.listFiles();
+ for ( final File entry : entries )
+ {
+ if ( filter == null
+ || filter.accept( directory,
+ entry.getName() ) )
+ {
+ files.add( entry );
+ }
+ if ( recurse
+ && entry.isDirectory() )
+ {
+ files.addAll( listFiles( entry,
+ filter,
+ recurse ) );
+ }
+ }
+ return files;
+ }
+
+ private static Collection< File > listNonEmptyDirectories( final File rootDirectory,
+ final boolean recurse )
+ {
+ final Collection< File > files = new ArrayList< File >();
+ final File[] entries = rootDirectory.listFiles( new DirectoryFilter() );
+ final FlexFilter flexFilter = new FlexFilter();
+
+ for ( final File entry : entries )
+ {
+ if ( entry.isDirectory()
+ && !listFiles( entry,
+ flexFilter,
+ false ).isEmpty() )
+ {
+ files.add( entry );
+ }
+ if ( recurse
+ && entry.isDirectory() )
+ {
+ files.addAll( listNonEmptyDirectories( entry,
+ recurse ) );
+ }
+ }
+ return files;
+ }
+
+ private Collection< File > nonEmptyDirectories = null;
+ private File sourceDirectory = null;
+
+ public AbstractMetrics( final File sourceDirectoryPath )
+ {
+ super();
+ if ( sourceDirectoryPath != null )
+ {
+ this.nonEmptyDirectories = listNonEmptyDirectories( sourceDirectoryPath,
+ true );
+ this.nonEmptyDirectories.add( sourceDirectoryPath );
+ this.sourceDirectory = sourceDirectoryPath;
+ }
+ }
+
+ public void execute( final File outputFile ) throws DocumentException,
+ IOException
+ {
+ final String builtReport = buildReport( loadMetrics() );
+ final Document document = DocumentHelper.parseText( builtReport );
+ final OutputFormat format = OutputFormat.createPrettyPrint();
+
+ if ( !outputFile.exists() )
+ {
+ if ( outputFile.createNewFile() == false )
+ {
+ LOGGER.warning( "Could not create a new output file" );
+ }
+ }
+
+ final XMLWriter writer = new XMLWriter( new FileOutputStream( outputFile ), format );
+ writer.write( document );
+ writer.close();
+ }
+
+ public abstract ProjectMetrics loadMetrics();
+
+ protected Collection< File > getNonEmptyDirectories()
+ {
+ return nonEmptyDirectories;
+ }
+
+ protected File getSourceDirectory()
+ {
+ return sourceDirectory;
+ }
+
+ private String addFunctions( final ProjectMetrics metrics )
+ {
+ final StringBuffer buffer = new StringBuffer( 250 );
+
+ buffer.append( "<functions>" );
+
+ for ( final FunctionMetrics functionMetrics : metrics.getFunctions() )
+ {
+ buffer.append( functionMetrics.toXmlString() );
+ }
+
+ buffer.append( MessageFormat.format( "<function_averages>"
+ + "<ncss>{0}</ncss>" + "<javadocs>{1}</javadocs>"
+ + "<javadoc_lines>{1}</javadoc_lines>"
+ + "<single_comment_lines>0</single_comment_lines>"
+ + "<multi_comment_lines>0</multi_comment_lines>"
+ + "</function_averages><ncss>{2}</ncss>" + "</functions>",
+ String.valueOf( metrics.getAverageFunctions()
+ .getAverageStatements() ),
+ String.valueOf( metrics.getAverageFunctions().getAverageDocs() ),
+ String.valueOf( metrics.getTotalPackages().getTotalStatements() ) ) );
+
+ return buffer.toString();
+ }
+
+ private String addObjects( final ProjectMetrics metrics )
+ {
+ final StringBuffer buffer = new StringBuffer( 300 );
+
+ buffer.append( "<objects>" );
+
+ for ( final ClassMetrics classMetrics : metrics.getClasses() )
+ {
+ buffer.append( classMetrics.toXmlString() );
+ }
+
+ buffer.append( MessageFormat.format( "<averages>"
+ + "<classes>{0}</classes>" + "<functions>{1}</functions>"
+ + "<ncss>{2}</ncss>" + "<javadocs>{3}</javadocs>"
+ + "<javadoc_lines>{3}</javadoc_lines>"
+ + "<single_comment_lines>0</single_comment_lines>"
+ + "<multi_comment_lines>0</multi_comment_lines>"
+ + "</averages><ncss>{4}</ncss>" + "</objects>",
+ String.valueOf( metrics.getClasses().size() ),
+ String.valueOf( metrics.getAverageObjects().getAverageFunctions() ),
+ String.valueOf( metrics.getAverageObjects().getAverageStatements() ),
+ String.valueOf( metrics.getAverageObjects().getAverageDocs() ),
+ String.valueOf( metrics.getTotalPackages().getTotalStatements() ) ) );
+ return buffer.toString();
+ }
+
+ private String addPackages( final ProjectMetrics metrics )
+ {
+ final StringBuffer buffer = new StringBuffer( 228 );
+
+ buffer.append( "<packages>" );
+
+ for ( final PackageMetrics packageMetrics : metrics.getPackages() )
+ {
+ buffer.append( packageMetrics.toXmlString() );
+ }
+
+ buffer.append( metrics.getTotalPackages().getContreteXml() );
+ buffer.append( "</packages>" );
+
+ return buffer.toString();
+ }
+
+ private String buildReport( final ProjectMetrics metrics )
+ {
+ final StringBuffer buf = new StringBuffer( 70 );
+
+ buf.append( "<?xml version=\"1.0\"?><javancss><date>"
+ + metrics.getDate() + "</date><time>" + metrics.getTime() + "</time>" );
+
+ buf.append( addPackages( metrics ) );
+ buf.append( addObjects( metrics ) );
+ buf.append( addFunctions( metrics ) );
+
+ buf.append( "</javancss>" );
+
+ return buf.toString();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/FlexMetrics.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/FlexMetrics.java b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/FlexMetrics.java
new file mode 100644
index 0000000..f50a44e
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/FlexMetrics.java
@@ -0,0 +1,148 @@
+/*
+ * 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.metrics.engine;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import net.sourceforge.pmd.PMDException;
+
+import com.adobe.ac.ncss.filters.FlexFilter;
+import com.adobe.ac.ncss.utils.FileUtils;
+import com.adobe.ac.pmd.files.FileSetUtils;
+import com.adobe.ac.pmd.files.IFlexFile;
+import com.adobe.ac.pmd.metrics.AverageClassMetrics;
+import com.adobe.ac.pmd.metrics.AverageFunctionMetrics;
+import com.adobe.ac.pmd.metrics.ClassMetrics;
+import com.adobe.ac.pmd.metrics.InternalFunctionMetrics;
+import com.adobe.ac.pmd.metrics.MetricUtils;
+import com.adobe.ac.pmd.metrics.PackageMetrics;
+import com.adobe.ac.pmd.metrics.ProjectMetrics;
+import com.adobe.ac.pmd.metrics.TotalPackageMetrics;
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.IPackage;
+
+public final class FlexMetrics extends AbstractMetrics
+{
+ private static final FlexFilter FLEX_FILTER = new FlexFilter();
+ private static final Logger LOGGER = Logger.getLogger( FlexMetrics.class.getName() );
+
+ private final Map< String, IPackage > asts;
+ private final double mxmlFactor;
+
+ public FlexMetrics( final File sourceDirectoryPath,
+ final double mxmlFactorToBeSet )
+ {
+ super( sourceDirectoryPath );
+
+ asts = initAst();
+ mxmlFactor = mxmlFactorToBeSet;
+ }
+
+ @Override
+ public ProjectMetrics loadMetrics()
+ {
+ final ProjectMetrics metrics = new ProjectMetrics();
+
+ for ( final File directory : getNonEmptyDirectories() )
+ {
+ final Collection< File > classesInPackage = FileUtils.listFiles( directory,
+ FLEX_FILTER,
+ false );
+
+ if ( directory.isDirectory()
+ && !classesInPackage.isEmpty() )
+ {
+ final String packageFullName = MetricUtils.getQualifiedName( getSourceDirectory(),
+ directory );
+ int functionsInPackage = 0;
+ int ncssInPackage = 0;
+ int asDocsInPackage = 0;
+ int multipleLineCommentInPackage = 0;
+ final int importsInPackage = 0;
+
+ for ( final File fileInPackage : classesInPackage )
+ {
+ IClass classNode = null;
+ InternalFunctionMetrics functionMetrics = null;
+ final IFlexFile file = com.adobe.ac.pmd.files.impl.FileUtils.create( fileInPackage,
+ getSourceDirectory() );
+ if ( asts.containsKey( file.getFullyQualifiedName() )
+ && asts.get( file.getFullyQualifiedName() ).getClassNode() != null )
+ {
+ classNode = asts.get( file.getFullyQualifiedName() ).getClassNode();
+ functionsInPackage += classNode.getFunctions().size();
+ functionMetrics = InternalFunctionMetrics.create( metrics,
+ packageFullName,
+ classNode );
+ asDocsInPackage += functionMetrics.getAsDocsInClass();
+ multipleLineCommentInPackage += functionMetrics.getMultipleLineCommentInClass();
+ ncssInPackage += functionMetrics.getNcssInClass();
+ }
+ final ClassMetrics classMetrics = ClassMetrics.create( packageFullName,
+ fileInPackage,
+ functionMetrics,
+ classNode,
+ file,
+ mxmlFactor );
+ asDocsInPackage += classMetrics.getAsDocs();
+ multipleLineCommentInPackage += classMetrics.getMultiLineComments();
+ metrics.getClassMetrics().add( classMetrics );
+ }
+ metrics.getPackageMetrics().add( PackageMetrics.create( classesInPackage,
+ packageFullName,
+ functionsInPackage,
+ ncssInPackage,
+ asDocsInPackage,
+ multipleLineCommentInPackage,
+ importsInPackage ) );
+ }
+ }
+ setFinalMetrics( metrics );
+
+ return metrics;
+ }
+
+ private Map< String, IPackage > initAst()
+ {
+ Map< String, IPackage > result = new LinkedHashMap< String, IPackage >();
+ try
+ {
+ result = FileSetUtils.computeAsts( com.adobe.ac.pmd.files.impl.FileUtils.computeFilesList( getSourceDirectory(),
+ null,
+ "",
+ null ) );
+ }
+ catch ( final PMDException e )
+ {
+ LOGGER.warning( e.getMessage() );
+ }
+ return result;
+ }
+
+ private void setFinalMetrics( final ProjectMetrics metrics )
+ {
+ metrics.setTotalPackages( TotalPackageMetrics.create( metrics.getPackageMetrics() ) );
+ metrics.setAverageFunctions( AverageFunctionMetrics.create( metrics.getFunctionMetrics(),
+ metrics.getTotalPackages() ) );
+ metrics.setAverageObjects( AverageClassMetrics.create( metrics.getClassMetrics(),
+ metrics.getTotalPackages() ) );
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/ClassMetricsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/ClassMetricsTest.java b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/ClassMetricsTest.java
new file mode 100644
index 0000000..4faf944
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/ClassMetricsTest.java
@@ -0,0 +1,162 @@
+/*
+ * 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.metrics;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+
+import net.sourceforge.pmd.PMDException;
+
+import org.junit.Test;
+
+import com.adobe.ac.pmd.FlexPmdTestBase;
+import com.adobe.ac.pmd.files.FileSetUtils;
+import com.adobe.ac.pmd.files.IFlexFile;
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.impl.NodeFactory;
+import com.adobe.ac.pmd.parser.IParserNode;
+
+public class ClassMetricsTest extends FlexPmdTestBase
+{
+ @Test
+ public void testBug157() throws PMDException
+ {
+ final IFlexFile file = getTestFiles().get( "bug.FlexPMD157.as" );
+ final IParserNode ast = FileSetUtils.buildAst( file );
+ final IClass classNode = NodeFactory.createPackage( ast ).getClassNode();
+ final ClassMetrics classMetrics = ClassMetrics.create( "bug",
+ new File( file.getFilePath() ),
+ InternalFunctionMetrics.create( new ProjectMetrics(),
+ file.getFullyQualifiedName(),
+ classNode ),
+ classNode,
+ file,
+ 0 );
+
+ assertEquals( "<object><name>bug.FlexPMD157</name><ccn>0</ccn><ncss>3</ncss><javadocs>0</javadocs>"
+ + "<javadoc_lines>0</javadoc_lines><multi_comment_lines>0</multi_comment_lines>"
+ + "<single_comment_lines>0</single_comment_lines><functions>0</functions></object>",
+ classMetrics.toXmlString() );
+ }
+
+ @Test
+ public void testBug181() throws PMDException
+ {
+ final IFlexFile file = getTestFiles().get( "bug.FlexPMD181.as" );
+ final IParserNode ast = FileSetUtils.buildAst( file );
+ final IClass classNode = NodeFactory.createPackage( ast ).getClassNode();
+ final ClassMetrics classMetrics = ClassMetrics.create( "bug",
+ new File( file.getFilePath() ),
+ InternalFunctionMetrics.create( new ProjectMetrics(),
+ file.getFullyQualifiedName(),
+ classNode ),
+ classNode,
+ file,
+ 0 );
+
+ assertEquals( "<object><name>bug.FlexPMD181</name><ccn>3</ccn><ncss>379</ncss><javadocs>1403"
+ + "</javadocs><javadoc_lines>1403</javadoc_lines><multi_comment_lines>4"
+ + "</multi_comment_lines><single_comment_lines>0</single_comment_lines>"
+ + "<functions>81</functions></object>",
+ classMetrics.toXmlString() );
+ }
+
+ @Test
+ public void testBug232() throws PMDException
+ {
+ final IFlexFile file = getTestFiles().get( "bug.FlexPMD232.as" );
+ final IParserNode ast = FileSetUtils.buildAst( file );
+ final IClass classNode = NodeFactory.createPackage( ast ).getClassNode();
+ final ClassMetrics classMetrics = ClassMetrics.create( "bug",
+ new File( file.getFilePath() ),
+ InternalFunctionMetrics.create( new ProjectMetrics(),
+ file.getFullyQualifiedName(),
+ classNode ),
+ classNode,
+ file,
+ 0 );
+
+ assertEquals( "<object><name>bug.FlexPMD232</name><ccn>4</ccn><ncss>7</ncss><javadocs>0</javadocs>"
+ + "<javadoc_lines>0</javadoc_lines><multi_comment_lines>0</multi_comment_lines>"
+ + "<single_comment_lines>0</single_comment_lines><functions>1</functions></object>",
+ classMetrics.toXmlString() );
+ }
+
+ @Test
+ public void testBug233() throws PMDException
+ {
+ final IFlexFile file = getTestFiles().get( "bug.Duane.mxml" );
+ final IParserNode ast = FileSetUtils.buildAst( file );
+ final IClass classNode = NodeFactory.createPackage( ast ).getClassNode();
+ final ClassMetrics classMetrics = ClassMetrics.create( "bug",
+ new File( file.getFilePath() ),
+ InternalFunctionMetrics.create( new ProjectMetrics(),
+ file.getFullyQualifiedName(),
+ classNode ),
+ classNode,
+ file,
+ 1 );
+
+ assertEquals( "<object><name>bug.Duane</name><ccn>1</ccn><ncss>217</ncss><javadocs>0</javadocs>"
+ + "<javadoc_lines>0</javadoc_lines><multi_comment_lines>0</multi_comment_lines>"
+ + "<single_comment_lines>0</single_comment_lines><functions>8</functions></object>",
+ classMetrics.toXmlString() );
+ }
+
+ @Test
+ public void testToXmlString() throws PMDException
+ {
+ final IFlexFile file = getTestFiles().get( "RadonDataGrid.as" );
+ final IParserNode ast = FileSetUtils.buildAst( file );
+ final IClass classNode = NodeFactory.createPackage( ast ).getClassNode();
+ final ClassMetrics classMetrics = ClassMetrics.create( "com.adobe.ac",
+ new File( file.getFilePath() ),
+ InternalFunctionMetrics.create( new ProjectMetrics(),
+ file.getFullyQualifiedName(),
+ classNode ),
+ classNode,
+ file,
+ 0 );
+
+ assertEquals( "<object><name>com.adobe.ac.RadonDataGrid</name><ccn>3</ccn><ncss>87</ncss><javadocs>0</javadocs>"
+ + "<javadoc_lines>0</javadoc_lines><multi_comment_lines>0</multi_comment_lines>"
+ + "<single_comment_lines>0</single_comment_lines><functions>7</functions></object>",
+ classMetrics.toXmlString() );
+ }
+
+ @Test
+ public void testToXmlStringWithMultiLineComments() throws PMDException
+ {
+ final IFlexFile file = getTestFiles().get( "bug.FlexPMD60.as" );
+ final IParserNode ast = FileSetUtils.buildAst( file );
+ final IClass classNode = NodeFactory.createPackage( ast ).getClassNode();
+ final ClassMetrics classMetrics = ClassMetrics.create( "bug",
+ new File( file.getFilePath() ),
+ InternalFunctionMetrics.create( new ProjectMetrics(),
+ file.getFullyQualifiedName(),
+ classNode ),
+ classNode,
+ file,
+ 0 );
+
+ assertEquals( "<object><name>bug.FlexPMD60</name><ccn>1</ccn><ncss>4</ncss><javadocs>9</javadocs>"
+ + "<javadoc_lines>9</javadoc_lines><multi_comment_lines>7</multi_comment_lines>"
+ + "<single_comment_lines>0</single_comment_lines><functions>1</functions></object>",
+ classMetrics.toXmlString() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/InternalFunctionMetricsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/InternalFunctionMetricsTest.java b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/InternalFunctionMetricsTest.java
new file mode 100644
index 0000000..b59ba0d
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/InternalFunctionMetricsTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd.metrics;
+
+import static org.junit.Assert.assertEquals;
+import net.sourceforge.pmd.PMDException;
+
+import org.junit.Test;
+
+import com.adobe.ac.pmd.FlexPmdTestBase;
+import com.adobe.ac.pmd.files.FileSetUtils;
+import com.adobe.ac.pmd.files.IFlexFile;
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.impl.NodeFactory;
+import com.adobe.ac.pmd.parser.IParserNode;
+
+public class InternalFunctionMetricsTest extends FlexPmdTestBase
+{
+ @Test
+ public void testCreate() throws PMDException
+ {
+ final IFlexFile file = getTestFiles().get( "bug.FlexPMD60.as" );
+ final IParserNode ast = FileSetUtils.buildAst( file );
+ final IClass classNode = NodeFactory.createPackage( ast ).getClassNode();
+ final InternalFunctionMetrics classMetrics = InternalFunctionMetrics.create( new ProjectMetrics(),
+ "bug",
+ classNode );
+
+ assertEquals( 1,
+ classMetrics.getMultipleLineCommentInClass() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/MetricUtilsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/MetricUtilsTest.java b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/MetricUtilsTest.java
new file mode 100644
index 0000000..7ede89f
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/MetricUtilsTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd.metrics;
+
+import static org.junit.Assert.assertEquals;
+import net.sourceforge.pmd.PMDException;
+
+import org.junit.Test;
+
+import com.adobe.ac.pmd.FlexPmdTestBase;
+import com.adobe.ac.pmd.files.FileSetUtils;
+import com.adobe.ac.pmd.files.IFlexFile;
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.impl.NodeFactory;
+import com.adobe.ac.pmd.parser.IParserNode;
+
+public class MetricUtilsTest extends FlexPmdTestBase
+{
+ @Test
+ public void testComputeMultiLineComments() throws PMDException
+ {
+ final IFlexFile file = getTestFiles().get( "bug.FlexPMD60.as" );
+ final IParserNode ast = FileSetUtils.buildAst( file );
+ final IClass classNode = NodeFactory.createPackage( ast ).getClassNode();
+
+ assertEquals( 6,
+ MetricUtils.computeMultiLineComments( classNode ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/PackageMetricsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/PackageMetricsTest.java b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/PackageMetricsTest.java
new file mode 100644
index 0000000..91835d3
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/PackageMetricsTest.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd.metrics;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.junit.Test;
+
+public class PackageMetricsTest
+{
+ private final PackageMetrics comAdobePackage;
+ private final PackageMetrics emptyPackage;
+
+ public PackageMetricsTest()
+ {
+ comAdobePackage = PackageMetrics.create( new ArrayList< File >(),
+ "com.adobe.ac",
+ 2,
+ 3,
+ 4,
+ 5,
+ 1 );
+ emptyPackage = PackageMetrics.create( new ArrayList< File >(),
+ "",
+ 2,
+ 3,
+ 4,
+ 5,
+ 2 );
+ }
+
+ @Test
+ public void testGetContreteXml()
+ {
+ assertEquals( "<functions>2</functions><classes>0</classes>",
+ comAdobePackage.getContreteXml() );
+ assertEquals( "<functions>2</functions><classes>0</classes>",
+ emptyPackage.getContreteXml() );
+ }
+
+ @Test
+ public void testToXmlString()
+ {
+ assertEquals( "<package><name>com.adobe.ac</name><ccn>0</ccn><ncss>5</ncss><javadocs>4</javadocs>"
+ + "<javadoc_lines>4</javadoc_lines><multi_comment_lines>5</multi_comment_lines>"
+ + "<single_comment_lines>0</single_comment_lines>"
+ + "<functions>2</functions><classes>0</classes></package>",
+ comAdobePackage.toXmlString() );
+ assertEquals( "<package><name>.</name><ccn>0</ccn><ncss>6</ncss><javadocs>4</javadocs>"
+ + "<javadoc_lines>4</javadoc_lines><multi_comment_lines>5</multi_comment_lines>"
+ + "<single_comment_lines>0</single_comment_lines>"
+ + "<functions>2</functions><classes>0</classes></package>",
+ emptyPackage.toXmlString() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/engine/FlexMetricsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/engine/FlexMetricsTest.java b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/engine/FlexMetricsTest.java
new file mode 100644
index 0000000..1f05f28
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/engine/FlexMetricsTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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.metrics.engine;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.dom4j.DocumentException;
+import org.junit.Test;
+
+import com.adobe.ac.pmd.FlexPmdTestBase;
+import com.adobe.ac.pmd.metrics.ProjectMetrics;
+
+public class FlexMetricsTest extends FlexPmdTestBase
+{
+ private static final int TOTAL_CLASSES_NUMBER = 105;
+ private static final int TOTAL_FUNCTIONS_NUMBER = 335;
+ private final FlexMetrics flexMetrics;
+ private final ProjectMetrics projectMetrics;
+
+ public FlexMetricsTest()
+ {
+ super();
+
+ flexMetrics = new FlexMetrics( getTestDirectory(), 0 );
+ projectMetrics = flexMetrics.loadMetrics();
+ }
+
+ @Test
+ public void execute() throws DocumentException,
+ IOException
+ {
+ final File outputFile = new File( "target/javancss.xml" );
+
+ flexMetrics.execute( outputFile );
+
+ assertTrue( outputFile.exists() );
+ }
+
+ @Test
+ public void loadAverageMetrics()
+ {
+ assertEquals( 5,
+ Math.round( projectMetrics.getAverageFunctions().getAverageStatements() ) );
+ assertEquals( 3,
+ Math.round( projectMetrics.getAverageObjects().getAverageFunctions() ) );
+ assertEquals( 15,
+ Math.round( projectMetrics.getAverageObjects().getAverageStatements() ) );
+ assertEquals( 30,
+ Math.round( projectMetrics.getAverageObjects().getAverageDocs() ) );
+ assertEquals( 2,
+ Math.round( projectMetrics.getAverageObjects().getAverageMultipleComments() + 0.95 ) );
+ }
+
+ @Test
+ public void loadClassMetrics()
+ {
+ assertEquals( TOTAL_CLASSES_NUMBER,
+ projectMetrics.getClasses().size() );
+ assertEquals( 0,
+ projectMetrics.getClasses().get( 3 ).getFunctions() );
+ assertEquals( "bug.FlexPMD233a",
+ projectMetrics.getClasses().get( 10 ).getFullName() );
+ assertEquals( 1,
+ projectMetrics.getClasses().get( 10 ).getNonCommentStatements() );
+ assertEquals( "bug.FlexPMD60",
+ projectMetrics.getClasses().get( 12 ).getFullName() );
+ assertEquals( 7,
+ projectMetrics.getClasses().get( 12 ).getMultiLineComments() );
+ assertEquals( "bug.FlexPMD61",
+ projectMetrics.getClasses().get( 13 ).getFullName() );
+ assertEquals( 3,
+ projectMetrics.getClasses().get( 13 ).getFunctions() );
+ assertEquals( 9,
+ projectMetrics.getClasses().get( 13 ).getNonCommentStatements() );
+ assertEquals( "cairngorm.FatController",
+ projectMetrics.getClasses().get( 20 ).getFullName() );
+ assertEquals( 3,
+ projectMetrics.getClasses().get( 20 ).getAsDocs() );
+ }
+
+ @Test
+ public void loadFunctionMetrics()
+ {
+ assertEquals( TOTAL_FUNCTIONS_NUMBER,
+ projectMetrics.getFunctions().size() );
+ assertEquals( "TestEvent",
+ projectMetrics.getFunctions().get( 103 ).getName() );
+ assertEquals( 3,
+ projectMetrics.getFunctions().get( 103 ).getNonCommentStatements() );
+ assertEquals( "clone",
+ projectMetrics.getFunctions().get( 104 ).getName() );
+ assertEquals( 2,
+ projectMetrics.getFunctions().get( 104 ).getNonCommentStatements() );
+ assertEquals( "BugDemo",
+ projectMetrics.getFunctions().get( 107 ).getName() );
+ assertEquals( 10,
+ projectMetrics.getFunctions().get( 107 ).getNonCommentStatements() );
+ }
+
+ @Test
+ public void loadPackageMetrics()
+ {
+ assertEquals( 30,
+ projectMetrics.getPackages().size() );
+ assertEquals( "",
+ projectMetrics.getPackages()
+ .get( projectMetrics.getPackages().size() - 1 )
+ .getPackageName() );
+ assertEquals( 17,
+ projectMetrics.getPackages().get( 1 ).getClasses() );
+ assertEquals( "bug",
+ projectMetrics.getPackages().get( 1 ).getFullName() );
+ assertEquals( 104,
+ projectMetrics.getPackages().get( 1 ).getFunctions() );
+ assertEquals( 400,
+ projectMetrics.getPackages().get( 1 ).getNonCommentStatements() );
+ assertEquals( "bug",
+ projectMetrics.getPackages().get( 1 ).getPackageName() );
+ }
+
+ @Test
+ public void loadTotalPackageMetrics()
+ {
+ assertEquals( TOTAL_CLASSES_NUMBER,
+ projectMetrics.getTotalPackages().getTotalClasses() );
+ assertEquals( TOTAL_FUNCTIONS_NUMBER,
+ projectMetrics.getTotalPackages().getTotalFunctions() );
+ assertEquals( 1615,
+ projectMetrics.getTotalPackages().getTotalStatements() );
+ assertEquals( 3188,
+ projectMetrics.getTotalPackages().getTotalAsDocs() );
+ assertEquals( 110,
+ projectMetrics.getTotalPackages().getTotalMultiLineComment() );
+ }
+
+ @Test
+ public void testBug157()
+ {
+ assertEquals( "org.as3commons.concurrency.thread",
+ projectMetrics.getPackageMetrics().get( 24 ).getFullName() );
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/.checkstyle
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/.checkstyle b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/.checkstyle
new file mode 100644
index 0000000..245c5ee
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/.checkstyle
@@ -0,0 +1,24 @@
+<?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.
+
+-->
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="AC" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/.pmd
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/.pmd b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/.pmd
new file mode 100644
index 0000000..b5c19d9
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/.pmd
@@ -0,0 +1,25 @@
+<?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.
+
+-->
+<pmd>
+ <useProjectRuleSet>false</useProjectRuleSet>
+ <ruleSetFile>../flex-pmd-parent/pmd.xml</ruleSetFile>
+ <includeDerivedFiles>false</includeDerivedFiles>
+ <violationsAsErrors>true</violationsAsErrors>
+</pmd>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/pom.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/pom.xml b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/pom.xml
new file mode 100644
index 0000000..4983ceb
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/pom.xml
@@ -0,0 +1,110 @@
+<?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.
+
+-->
+<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-ruleset-api</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Adobe Flex PMD RuleSet API</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>${commons-lang.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>as3-plugin-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>pmd</groupId>
+ <artifactId>pmd</artifactId>
+ <version>${pmd.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>as3-parser</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>flex-pmd-files</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>flex-pmd-test-resources</artifactId>
+ <version>${project.version}</version>
+ <classifier>resources</classifier>
+ <type>zip</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <testResources>
+ <testResource>
+ <directory>${project.build.directory}/test/generated-resources</directory>
+ </testResource>
+ <testResource>
+ <directory>${basedir}/src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-test-resources</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeGroupIds>${project.groupId}</includeGroupIds>
+ <includes>**/*.as,**/*.mxml</includes>
+ <outputDirectory>${project.build.directory}/test/generated-resources</outputDirectory>
+ <excludeTransitive>true</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/IFlexViolation.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/IFlexViolation.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/IFlexViolation.java
new file mode 100644
index 0000000..efdc6b5
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/IFlexViolation.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;
+
+import net.sourceforge.pmd.IRuleViolation;
+
+import com.adobe.ac.pmd.files.IFlexFile;
+
+public interface IFlexViolation extends Comparable< IFlexViolation >, IRuleViolation
+{
+ /**
+ * @param messageToAppend
+ */
+ void appendToMessage( final String messageToAppend );
+
+ /**
+ * @return the rule message
+ */
+ String getRuleMessage();
+
+ /**
+ * @param replacement
+ * @param index
+ */
+ void replacePlaceholderInMessage( final String replacement,
+ final int index );
+
+ /**
+ * @param column
+ */
+ void setEndColumn( final int column );
+
+ /**
+ * @param violatedFile
+ * @param ruleSetName
+ * @return
+ */
+ String toXmlString( final IFlexFile violatedFile,
+ final String ruleSetName );
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/files/FileSetUtils.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/files/FileSetUtils.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/files/FileSetUtils.java
new file mode 100644
index 0000000..e7c6ad0
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/files/FileSetUtils.java
@@ -0,0 +1,179 @@
+/*
+ * 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.files;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
+
+import net.sourceforge.pmd.PMDException;
+
+import com.adobe.ac.pmd.nodes.IPackage;
+import com.adobe.ac.pmd.nodes.impl.NodeFactory;
+import com.adobe.ac.pmd.parser.IAS3Parser;
+import com.adobe.ac.pmd.parser.IParserNode;
+import com.adobe.ac.pmd.parser.exceptions.TokenException;
+
+import de.bokelberg.flex.parser.AS3Parser;
+
+/**
+ * @author xagnetti
+ */
+public final class FileSetUtils
+{
+ private static final ThreadPoolExecutor EXECUTOR = ( ThreadPoolExecutor ) Executors.newFixedThreadPool( 5 );
+ private static final Logger LOGGER = Logger.getLogger( FileSetUtils.class.getName() );
+
+ /**
+ * @param file
+ * @return
+ * @throws PMDException
+ */
+ public static IParserNode buildAst( final IFlexFile file ) throws PMDException
+ {
+ IParserNode rootNode = null;
+
+ try
+ {
+ rootNode = tryToBuildAst( file );
+ }
+ catch ( final IOException e )
+ {
+ throw new PMDException( "While building AST: Cannot read "
+ + file.getFullyQualifiedName(), e );
+ }
+ catch ( final TokenException e )
+ {
+ throw new PMDException( "TokenException thrown while building AST on "
+ + file.getFullyQualifiedName() + " with message: " + e.getMessage(), e );
+ }
+ return rootNode;
+ }
+
+ /**
+ * @param file
+ * @return
+ * @throws PMDException
+ * @throws InterruptedException
+ * @throws ExecutionException
+ */
+ public static IParserNode buildThreadedAst( final IFlexFile file ) throws PMDException,
+ InterruptedException,
+ ExecutionException
+ {
+ final List< Callable< Object >> toRun = new ArrayList< Callable< Object >>();
+ toRun.add( new Callable< Object >()
+ {
+ public Object call() throws PMDException
+ {
+ return buildAst( file );
+ }
+ } );
+ final List< Future< Object >> futures = EXECUTOR.invokeAll( toRun,
+ 5,
+ TimeUnit.SECONDS );
+ return ( IParserNode ) futures.get( 0 ).get();
+ }
+
+ /**
+ * @param files
+ * @return
+ * @throws PMDException
+ */
+ public static Map< String, IPackage > computeAsts( final Map< String, IFlexFile > files ) throws PMDException
+ {
+ final Map< String, IPackage > asts = new LinkedHashMap< String, IPackage >();
+
+ for ( final Entry< String, IFlexFile > fileEntry : files.entrySet() )
+ {
+ final IFlexFile file = fileEntry.getValue();
+
+ try
+ {
+ final IParserNode node = buildThreadedAst( file );
+
+ asts.put( file.getFullyQualifiedName(),
+ NodeFactory.createPackage( node ) );
+ }
+ catch ( final InterruptedException e )
+ {
+ LOGGER.warning( buildLogMessage( file,
+ e.getMessage() ) );
+ }
+ catch ( final NoClassDefFoundError e )
+ {
+ LOGGER.warning( buildLogMessage( file,
+ e.getMessage() ) );
+ }
+ catch ( final ExecutionException e )
+ {
+ LOGGER.warning( buildLogMessage( file,
+ e.getMessage() ) );
+ }
+ catch ( final CancellationException e )
+ {
+ LOGGER.warning( buildLogMessage( file,
+ e.getMessage() ) );
+ }
+ }
+ return asts;
+ }
+
+ /**
+ * @param file
+ * @param message
+ * @return
+ */
+ protected static String buildLogMessage( final IFlexFile file,
+ final String message )
+ {
+ return "While building AST on "
+ + file.getFullyQualifiedName() + ", an error occured: " + message;
+ }
+
+ private static IParserNode tryToBuildAst( final IFlexFile file ) throws IOException,
+ TokenException
+ {
+ IParserNode rootNode;
+ final IAS3Parser parser = new AS3Parser();
+ if ( file instanceof IMxmlFile )
+ {
+ rootNode = parser.buildAst( file.getFilePath(),
+ ( ( IMxmlFile ) file ).getScriptBlock() );
+ }
+ else
+ {
+ rootNode = parser.buildAst( file.getFilePath() );
+ }
+ return rootNode;
+ }
+
+ private FileSetUtils()
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IAsDocHolder.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IAsDocHolder.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IAsDocHolder.java
new file mode 100644
index 0000000..d4885e2
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IAsDocHolder.java
@@ -0,0 +1,30 @@
+/*
+ * 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.nodes;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * @author xagnetti
+ */
+public interface IAsDocHolder extends INode
+{
+ /**
+ * @return AsDoc information
+ */
+ IParserNode getAsDoc();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IAttribute.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IAttribute.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IAttribute.java
new file mode 100644
index 0000000..c07b309
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IAttribute.java
@@ -0,0 +1,24 @@
+/*
+ * 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.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IAttribute extends IField
+{
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IClass.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IClass.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IClass.java
new file mode 100644
index 0000000..01235b2
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IClass.java
@@ -0,0 +1,81 @@
+/*
+ * 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.nodes;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * Node representing a class. It contains different lists (constants, variables,
+ * functions, implementations, ...), but also a reference to its constructor (if
+ * any), the extension name (if any), and its name.
+ *
+ * @author xagnetti
+ */
+public interface IClass extends IVisible, IMetaDataListHolder, INamableNode, IAsDocHolder, ICommentHolder
+{
+ /**
+ * @return
+ */
+ List< IAttribute > getAttributes();
+
+ /**
+ * @return
+ */
+ double getAverageCyclomaticComplexity();
+
+ /**
+ * @return
+ */
+ IParserNode getBlock();
+
+ /**
+ * @return
+ */
+ List< IConstant > getConstants();
+
+ /**
+ * @return
+ */
+ IFunction getConstructor();
+
+ /**
+ * @return
+ */
+ String getExtensionName();
+
+ /**
+ * @return
+ */
+ List< IFunction > getFunctions();
+
+ /**
+ * @return
+ */
+ List< IParserNode > getImplementations();
+
+ /**
+ * @return
+ */
+ boolean isBindable();
+
+ /**
+ * @return
+ */
+ boolean isFinal();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/ICommentHolder.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/ICommentHolder.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/ICommentHolder.java
new file mode 100644
index 0000000..5094f90
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/ICommentHolder.java
@@ -0,0 +1,32 @@
+/*
+ * 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.nodes;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * @author xagnetti
+ */
+public interface ICommentHolder
+{
+ /**
+ * @return
+ */
+ List< IParserNode > getMultiLinesComment();
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IConstant.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IConstant.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IConstant.java
new file mode 100644
index 0000000..d5b8f39
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IConstant.java
@@ -0,0 +1,24 @@
+/*
+ * 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.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IConstant extends IField
+{
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IField.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IField.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IField.java
new file mode 100644
index 0000000..81a2979
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IField.java
@@ -0,0 +1,28 @@
+/*
+ * 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.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IField extends IVariable, IVisible, IAsDocHolder
+{
+ /**
+ * @return
+ */
+ boolean isStatic();
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFieldInitialization.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFieldInitialization.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFieldInitialization.java
new file mode 100644
index 0000000..87d6980
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFieldInitialization.java
@@ -0,0 +1,24 @@
+/*
+ * 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.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IFieldInitialization extends INode
+{
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFunction.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFunction.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFunction.java
new file mode 100644
index 0000000..e2124f1
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFunction.java
@@ -0,0 +1,100 @@
+/*
+ * 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.nodes;
+
+import java.util.List;
+import java.util.Map;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * Node representing a Function It contains the function name, its parameters,
+ * its return type, its modifiers, its metadata
+ *
+ * @author xagnetti
+ */
+public interface IFunction extends IVisible, IMetaDataListHolder, INamableNode, IAsDocHolder, ICommentHolder
+{
+ /**
+ * Finds recursively a statement in the function body from a list of names
+ *
+ * @param primaryNames statement name
+ * @return corresponding node
+ */
+ List< IParserNode > findPrimaryStatementInBody( final String[] primaryNames );
+
+ /**
+ * Finds recursively a statement in the function body from its name
+ *
+ * @param primaryName statement name
+ * @return corresponding node
+ */
+ List< IParserNode > findPrimaryStatementsInBody( final String primaryName );
+
+ /**
+ * @return
+ */
+ IParserNode getBody();
+
+ /**
+ * @return
+ */
+ int getCyclomaticComplexity();
+
+ /**
+ * @return
+ */
+ Map< String, IParserNode > getLocalVariables();
+
+ /**
+ * @return
+ */
+ List< IParameter > getParameters();
+
+ /**
+ * @return
+ */
+ IIdentifierNode getReturnType();
+
+ /**
+ * @return
+ */
+ int getStatementNbInBody();
+
+ /**
+ * @return Extracts the super call node (if any) from the function content
+ * block
+ */
+ IParserNode getSuperCall();
+
+ boolean isEventHandler();
+
+ /**
+ * @return
+ */
+ boolean isGetter();
+
+ /**
+ * @return
+ */
+ boolean isOverriden();
+
+ /**
+ * @return
+ */
+ boolean isSetter();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IIdentifierNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IIdentifierNode.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IIdentifierNode.java
new file mode 100644
index 0000000..28b5d11
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IIdentifierNode.java
@@ -0,0 +1,25 @@
+/*
+ * 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.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IIdentifierNode extends INode
+{
+
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaData.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaData.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaData.java
new file mode 100644
index 0000000..ac6fd0b
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaData.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.nodes;
+
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+public interface IMetaData extends INamable, INode
+{
+ /**
+ * @return
+ */
+ List< String > getAttributeNames();
+
+ /**
+ * @return
+ */
+ String getDefaultValue();
+
+ /**
+ * @param property
+ * @return
+ */
+ String[] getProperty( final String property );
+
+ /**
+ * @param property
+ * @return
+ */
+ List< String > getPropertyAsList( final String property );
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaDataListHolder.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaDataListHolder.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaDataListHolder.java
new file mode 100644
index 0000000..2622556
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaDataListHolder.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd.nodes;
+
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+public interface IMetaDataListHolder
+{
+ /**
+ * @param metaData
+ */
+ void add( IMetaData metaData );
+
+ /**
+ * @return
+ */
+ List< IMetaData > getAllMetaData();
+
+ /**
+ * @param metaDataName
+ * @return
+ */
+ List< IMetaData > getMetaData( MetaData metaDataName );
+
+ /**
+ * @return
+ */
+ int getMetaDataCount();
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IModifiersHolder.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IModifiersHolder.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IModifiersHolder.java
new file mode 100644
index 0000000..8ed7eb5
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IModifiersHolder.java
@@ -0,0 +1,34 @@
+/*
+ * 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.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IModifiersHolder
+{
+ /**
+ * @param modifier
+ */
+ void add( Modifier modifier );
+
+ /**
+ * @param modifier
+ * @return
+ */
+ boolean is( Modifier modifier ); // NOPMD
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamable.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamable.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamable.java
new file mode 100644
index 0000000..2ebad51
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamable.java
@@ -0,0 +1,28 @@
+/*
+ * 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.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface INamable
+{
+ /**
+ * @return
+ */
+ String getName();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamableNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamableNode.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamableNode.java
new file mode 100644
index 0000000..24ea835
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamableNode.java
@@ -0,0 +1,25 @@
+/*
+ * 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.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface INamableNode extends INode, INamable
+{
+
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e43b7a87/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INode.java b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INode.java
new file mode 100644
index 0000000..04f4c9e
--- /dev/null
+++ b/FlexPMD/flex-pmd-java/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INode.java
@@ -0,0 +1,32 @@
+/*
+ * 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.nodes;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * FlexPmdNode which wraps the parser node into a concrete type
+ *
+ * @author xagnetti
+ */
+public interface INode
+{
+ /**
+ * @return
+ */
+ IParserNode getInternalNode();
+}