You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/04/25 08:18:25 UTC
[26/46] FlexPMD Donation from Adobe Systems Inc
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/AbstractMetrics.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/AbstractMetrics.java b/FlexPMD/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-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/b0fc5f17/FlexPMD/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/FlexMetrics.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-metrics/src/main/java/com/adobe/ac/pmd/metrics/engine/FlexMetrics.java b/FlexPMD/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-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/b0fc5f17/FlexPMD/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/ClassMetricsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/ClassMetricsTest.java b/FlexPMD/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-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/b0fc5f17/FlexPMD/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/InternalFunctionMetricsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/InternalFunctionMetricsTest.java b/FlexPMD/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-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/b0fc5f17/FlexPMD/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/MetricUtilsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/MetricUtilsTest.java b/FlexPMD/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-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/b0fc5f17/FlexPMD/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/PackageMetricsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/PackageMetricsTest.java b/FlexPMD/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-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/b0fc5f17/FlexPMD/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/engine/FlexMetricsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-metrics/src/test/java/com/adobe/ac/pmd/metrics/engine/FlexMetricsTest.java b/FlexPMD/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-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/b0fc5f17/FlexPMD/flex-pmd-parent/.pmd
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-parent/.pmd b/FlexPMD/flex-pmd-parent/.pmd
new file mode 100644
index 0000000..791de4a
--- /dev/null
+++ b/FlexPMD/flex-pmd-parent/.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>./pmd.xml</ruleSetFile>
+ <includeDerivedFiles>false</includeDerivedFiles>
+ <violationsAsErrors>true</violationsAsErrors>
+</pmd>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-parent/checkstyle.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-parent/checkstyle.xml b/FlexPMD/flex-pmd-parent/checkstyle.xml
new file mode 100644
index 0000000..a7cb9ab
--- /dev/null
+++ b/FlexPMD/flex-pmd-parent/checkstyle.xml
@@ -0,0 +1,78 @@
+<?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.
+
+-->
+ <!--
+ This configuration file was written by the eclipse-cs plugin
+ configuration editor
+ -->
+ <!--
+ Checkstyle-Configuration: AdobeProfessionalSerives Description: Adobe
+ Professional Services checkstyle ruleset
+ -->
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+<module name="Checker">
+ <property name="severity" value="warning" />
+ <module name="TreeWalker">
+ <module name="AbstractClassName" />
+ <module name="ConstantName" />
+ <module name="LocalFinalVariableName" />
+ <module name="LocalVariableName" />
+ <module name="MemberName" />
+ <module name="MethodName" />
+ <module name="ParameterName" />
+ <module name="StaticVariableName" />
+ <module name="TypeName" />
+ <module name="FileLength" />
+ <module name="LineLength">
+ <property name="max" value="120" />
+ </module>
+ <module name="MethodLength">
+ <property name="max" value="50" />
+ </module>
+ <module name="ParameterNumber">
+ <property name="max" value="4" />
+ </module>
+ <module name="AvoidInlineConditionals">
+ <property name="severity" value="ignore" />
+ </module>
+ <module name="DefaultComesLast" />
+ <module name="EmptyStatement" />
+ <module name="ExplicitInitialization">
+ <property name="severity" value="ignore" />
+ </module>
+ <module name="FallThrough" />
+ <module name="HiddenField" />
+ <module name="IllegalInstantiation" />
+ <module name="IllegalCatch" />
+ <module name="IllegalThrows" />
+ <module name="MagicNumber">
+ <property name="severity" value="ignore" />
+ </module>
+ <module name="ParameterAssignment" />
+ <module name="SimplifyBooleanExpression" />
+ <module name="SimplifyBooleanReturn" />
+ <module name="SuperClone" />
+ <module name="UnnecessaryParentheses" />
+ <module name="FinalClass" />
+ <module name="DesignForExtension">
+ <property name="severity" value="ignore" />
+ </module>
+ <module name="ArrayTypeStyle" />
+ </module>
+</module>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-parent/cleanup.profile.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-parent/cleanup.profile.xml b/FlexPMD/flex-pmd-parent/cleanup.profile.xml
new file mode 100644
index 0000000..f437848
--- /dev/null
+++ b/FlexPMD/flex-pmd-parent/cleanup.profile.xml
@@ -0,0 +1,95 @@
+<?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.
+
+-->
+ <!-- Profile to be imported in Eclipse clean-up tool -->
+<profiles version="2">
+ <profile kind="CleanUpProfile" name="Ac" version="2">
+ <setting
+ id="cleanup.use_this_for_non_static_field_access_only_if_necessary"
+ value="true" />
+ <setting id="cleanup.always_use_blocks" value="true" />
+ <setting id="cleanup.qualify_static_method_accesses_with_declaring_class"
+ value="false" />
+ <setting id="cleanup.remove_unused_private_fields" value="true" />
+ <setting id="cleanup.always_use_this_for_non_static_method_access"
+ value="false" />
+ <setting id="cleanup.qualify_static_field_accesses_with_declaring_class"
+ value="false" />
+ <setting
+ id="cleanup.use_this_for_non_static_method_access_only_if_necessary"
+ value="true" />
+ <setting id="cleanup.remove_unused_private_types" value="true" />
+ <setting id="cleanup.always_use_parentheses_in_expressions"
+ value="false" />
+ <setting
+ id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class"
+ value="true" />
+ <setting id="cleanup.remove_unused_local_variables" value="true" />
+ <setting id="cleanup.add_missing_override_annotations" value="true" />
+ <setting id="cleanup.remove_trailing_whitespaces_all" value="true" />
+ <setting id="cleanup.organize_imports" value="true" />
+ <setting id="cleanup.remove_unnecessary_nls_tags" value="true" />
+ <setting id="cleanup.add_missing_methods" value="false" />
+ <setting id="cleanup.remove_trailing_whitespaces_ignore_empty"
+ value="false" />
+ <setting id="cleanup.use_parentheses_in_expressions" value="true" />
+ <setting id="cleanup.make_type_abstract_if_missing_method"
+ value="false" />
+ <setting id="cleanup.sort_members" value="true" />
+ <setting
+ id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class"
+ value="true" />
+ <setting id="cleanup.use_blocks_only_for_return_and_throw"
+ value="false" />
+ <setting id="cleanup.use_blocks" value="true" />
+ <setting id="cleanup.make_private_fields_final" value="true" />
+ <setting id="cleanup.remove_unused_private_methods" value="true" />
+ <setting id="cleanup.correct_indentation" value="false" />
+ <setting id="cleanup.use_this_for_non_static_field_access"
+ value="true" />
+ <setting id="cleanup.remove_unnecessary_casts" value="true" />
+ <setting id="cleanup.sort_members_all" value="true" />
+ <setting id="cleanup.format_source_code_changes_only" value="false" />
+ <setting id="cleanup.make_local_variable_final" value="true" />
+ <setting id="cleanup.never_use_parentheses_in_expressions"
+ value="true" />
+ <setting id="cleanup.remove_trailing_whitespaces" value="true" />
+ <setting id="cleanup.convert_to_enhanced_for_loop" value="true" />
+ <setting id="cleanup.format_source_code" value="false" />
+ <setting id="cleanup.add_missing_nls_tags" value="false" />
+ <setting id="cleanup.add_missing_annotations" value="true" />
+ <setting id="cleanup.use_this_for_non_static_method_access"
+ value="true" />
+ <setting id="cleanup.make_variable_declarations_final" value="true" />
+ <setting id="cleanup.make_parameters_final" value="true" />
+ <setting id="cleanup.remove_private_constructors" value="true" />
+ <setting id="cleanup.add_generated_serial_version_id" value="false" />
+ <setting id="cleanup.add_missing_deprecated_annotations"
+ value="true" />
+ <setting id="cleanup.qualify_static_member_accesses_with_declaring_class"
+ value="true" />
+ <setting id="cleanup.always_use_this_for_non_static_field_access"
+ value="false" />
+ <setting id="cleanup.never_use_blocks" value="false" />
+ <setting id="cleanup.add_serial_version_id" value="false" />
+ <setting id="cleanup.add_default_serial_version_id" value="true" />
+ <setting id="cleanup.remove_unused_imports" value="true" />
+ <setting id="cleanup.remove_unused_private_members" value="true" />
+ </profile>
+</profiles>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-parent/flex-formatter.properties
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-parent/flex-formatter.properties b/FlexPMD/flex-pmd-parent/flex-formatter.properties
new file mode 100644
index 0000000..84976c6
--- /dev/null
+++ b/FlexPMD/flex-pmd-parent/flex-formatter.properties
@@ -0,0 +1,74 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#FlexPrettyPrintSettings
+#Mon May 18 16:11:58 CEST 2009
+Actionscript.spacesBeforeComma=0
+Actionscript.newLineAfterBindable=true
+Actionscript.putCatchOnNewLine=true
+MXML.spacesAroundEquals=0
+Actionscript.wrapArrayDeclMode=8
+Actionscript.useBraceStyle=false
+Actionscript.advancedSpacesInsideLiteralBraces=0
+MXML.attrWrapMode=52
+Actionscript.alwaysGenerateIndent=false
+MXML.keepBlankLines=true
+MXML.attrsToKeepOnSameLine=1
+MXML.spacesBeforeEmptyTagEnd=0
+MXML.wrapIndentStyle=1000
+Actionscript.spacesAfterLabel=1
+Actionscript.advancedSpacesAroundEqualsInOptionalParameters=1
+MXML.tagsCannotFormat=mx\:String,
+Actionscript.breakLinesBeforeComma=false
+Actionscript.collapseSpacesForAdjacentParens=false
+Actionscript.advancedUseSpacesAroundEqualsInOptionalParameters=true
+Actionscript.advancedSpacesInsideArrayRefBrackets=0
+Actionscript.blankLinesBeforeFunctions=1
+Actionscript.useGlobalSpacesInsideParens=true
+MXML.sortAttrData=%namespace%\n%properties%\n%styles%\n%events%\n%effects%\n
+Actionscript.wrapMethodDeclMode=8
+Actionscript.blankLinesBeforeClasses=1
+MXML.useAttrsToKeepOnSameLine=false
+Actionscript.putElseOnNewLine=true
+MXML.maxLineLength=100
+Actionscript.spacesBeforeControlOpenParen=1
+MXML.sortExtraAttrs=true
+MXML.blankLinesBeforeTags=0
+Actionscript.spacesInsideParens=1
+Actionscript.maxLineLength=120
+Actionscript.putEmptyStatementsOnNewLine=true
+Flex.useTabs=false
+Actionscript.keepSLCommentsOnColumn1=true
+MXML.sortAttrMode=2
+Actionscript.spacesAroundBinarySymbolicOperator=1
+MXML.tagsToHaveBlankLinesAddedBeforeThem=
+Actionscript.wrapEmbeddedXMLMode=2
+Actionscript.spacesAfterComma=1
+Actionscript.advancedSpacesInsideArrayDeclBrackets=0
+Actionscript.advancedSpacesInsideParens=0
+Actionscript.blankLinesBeforeControlStatements=1
+Actionscript.wrapIndentStyle=1000
+Actionscript.wrapExpressionMode=8
+Actionscript.putOpenBraceOnNewLine=true
+MXML.attrsPerLine=1
+Actionscript.spacesAroundAssignment=1
+Actionscript.spacesAroundColons=1
+Actionscript.keepBlankLines=true
+Actionscript.keepElseIfOnSameLine=true
+MXML.attrGroups=name\=properties|sort\=13|wrap\=54|attrs\=id,width,height,styleName,label,text,allowDisjointSelection,allowMultipleSelection,allowThumbOverlap,allowTrackClick,autoLayout,autoRepeat,automationName,cachePolicy,class,clipContent,condenseWhite,conversion,creationIndex,creationPolicy,currentState,data,dataDescriptor,dataProvider,dataTipFormatFunction,dayNames,defaultButton,direction,disabledDays,disabledRanges,displayedMonth,displayedYear,doubleClickEnabled,emphasized,enabled,explicitHeight,explicitMaxHeight,explicitMaxWidth,explicitMinHeight,explicitMinWidth,explicitWidth,firstDayOfWeek,focusEnabled,fontContext,horizontalLineScrollSize,horizontalPageScrollSize,horizontalScrollBar,horizontalScrollPolicy,horizontalScrollPosition,htmlText,icon,iconField,imeMode,includeInLayout,indeterminate,labelField,labelFunction,labelPlacement,labels,layout,lineScrollSize,listData,liveDragging,maxChars,maxHeight,maxScrollPosition,maxWidth,maxYear,maximum,measuredHeight,measuredMinHeight,
measuredMinWidth,measuredWidth,menuBarItemRenderer,menuBarItems,menus,minHeight,minScrollPosition,minWidth,minYear,minimum,mode,monthNames,monthSymbol,mouseFocusEnabled,pageScrollSize,pageSize,percentHeight,percentWidth,scaleX,scaleY,scrollPosition,selectable,selectableRange,selected,selectedDate,selectedField,selectedIndex,selectedRanges,showDataTip,showRoot,showToday,sliderDataTipClass,sliderThumbClass,snapInterval,source,states,stepSize,stickyHighlighting,text,thumbCount,tickInterval,tickValues,toggle,toolTip,transitions,truncateToFit,validationSubField,value,value,verticalLineScrollSize,verticalPageScrollSize,verticalScrollBar,verticalScrollPolicy,verticalScrollPosition,x,y,yearNavigationEnabled,yearSymbol,|\nname\=events|sort\=11|wrap\=54|attrs\=add,buttonDown,change,childAdd,childIndexChange,childRemove,clickHandler,complete,creationComplete,currentStateChange,currentStateChanging,dataChange,dragComplete,dragDrop,dragEnter,dragExit,dragOver,effectEnd,effectStart,enterState,exi
tState,hide,initialize,invalid,itemClick,itemRollOut,itemRollOver,menuHide,menuShow,mouseDownOutside,mouseWheelOutside,move,preinitialize,progress,record,remove,resize,scroll,show,thumbDrag,thumbPress,thumbRelease,toolTipCreate,toolTipEnd,toolTipHide,toolTipShow,toolTipShown,toolTipStart,updateComplete,valid,valueCommit,|\nname\=styles|sort\=11|wrap\=54|attrs\=backgroundAlpha,backgroundAttachment,backgroundColor,backgroundDisabledColor,backgroundImage,backgroundSize,backgroundSkin,barColor,barSkin,borderColor,borderSides,borderSkin,borderStyle,borderThickness,bottom,color,cornerRadius,dataTipOffset,dataTipPrecision,dataTipStyleName,disabledColor,disabledIcon,disabledIconColor,disabledSkin,disbledOverlayAlpha,downArrowDisabledSkin,downArrowDownSkin,downArrowOverSkin,downArrowUpSkin,downIcon,downSkin,dropShadowColor,dropShadowEnabled,errorColor,fillAlphas,fillColors,focusAlpha,focusBlendMode,focusRoundedCorners,focusSkin,focusThickness,fontAntiAliasType,fontFamily,fontGridFitType,font
Sharpness,fontSize,fontStyle,fontThickness,fontWeight,fontfamily,headerColors,headerStyleName,highlightAlphas,horizontalAlign,horizontalCenter,horizontalGap,horizontalScrollBarStyleName,icon,iconColor,indeterminateMoveInterval,indeterminateSkin,itemDownSkin,itemOverSkin,itemUpSkin,kerning,labelOffset,labelStyleName,labelWidth,leading,left,letterSpacing,maskSkin,menuStyleName,nextMonthDisabledSkin,nextMonthDownSkin,nextMonthOverSkin,nextMonthSkin,nextMonthUpSkin,nextYearDisabledSkin,nextYearDownSkin,nextYearOverSkin,nextYearSkin,nextYearUpSkin,overIcon,overSkin,paddingBottom,paddingLeft,paddingRight,paddingTop,prevMonthDisabledSkin,prevMonthDownSkin,prevMonthOverSkin,prevMonthSkin,prevMonthUpSkin,prevYearDisabledSkin,prevYearDownSkin,prevYearOverSkin,prevYearSkin,prevYearUpSkin,repeatDelay,repeatInterval,right,rollOverColor,rollOverIndicatorSkin,selectedDisabledIcon,selectedDisabledSkin,selectedDownIcon,selectedDownSkin,selectedOverIcon,selectedOverSkin,selectedUpIcon,selectedUpSkin,
selectionColor,selectionIndicatorSkin,shadowColor,shadowDirection,shadowDistance,showTrackHighlight,skin,slideDuration,slideEasingFunction,strokeColor,strokeWidth,textAlign,textDecoration,textIndent,textRollOverColor,textSelectedColor,themeColor,thumbDisabledSkin,thumbDownSkin,thumbIcon,thumbOffset,thumbOverSkin,thumbUpSkin,tickColor,tickLength,tickOffset,tickThickness,todayColor,todayIndicatorSkin,todayStyleName,top,tracHighlightSkin,trackColors,trackHeight,trackMargin,trackSkin,upArrowDisabledSkin,upArrowDownSkin,upArrowOverSkin,upArrowUpSkin,upIcon,upSkin,verticalAlign,verticalCenter,verticalGap,verticalScrollBarStyleName,weekDayStyleName,|\nname\=effects|sort\=11|wrap\=54|attrs\=addedEffect,completeEffect,creationCompleteEffect,focusInEffect,focusOutEffect,hideEffect,mouseDownEffect,mouseUpEffect,moveEffect,removedEffect,resizeEffect,rollOutEffect,rollOverEffect,showEffect,|\nname\=namespace|sort\=11|wrap\=54|attrs\=xmlns\:.*,|\n
+MXML.addNewlineAfterLastAttr=true
+Actionscript.braceStyle=5
+Actionscript.wrapMethodCallMode=8
+MXML.tagsCanFormat=mx\:List,