You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by dk...@apache.org on 2006/05/19 23:36:35 UTC

svn commit: r407916 - in /incubator/tuscany/java: ./ buildtools/ buildtools/src/ buildtools/src/main/ buildtools/src/main/resources/ sca/ sca/bindings/binding.celtix/

Author: dkulp
Date: Fri May 19 14:36:34 2006
New Revision: 407916

URL: http://svn.apache.org/viewvc?rev=407916&view=rev
Log:
Put in place initial infrastructure for checkstyle as suggested on:
http://maven.apache.org/plugins/maven-checkstyle-plugin/tips.html

Use "mvn -Psourcecheck" to activate the profile.  Default is to report everything as warnings, not errors except for celtix binding which will fail the build on checkstyle violations.

Final rules are yet to be decided, but this allows testing and such.


Added:
    incubator/tuscany/java/buildtools/
    incubator/tuscany/java/buildtools/pom.xml   (with props)
    incubator/tuscany/java/buildtools/src/
    incubator/tuscany/java/buildtools/src/main/
    incubator/tuscany/java/buildtools/src/main/resources/
    incubator/tuscany/java/buildtools/src/main/resources/tuscany-checkstyle.xml   (with props)
Removed:
    incubator/tuscany/java/sca/bindings/binding.celtix/checkstyle.xml
Modified:
    incubator/tuscany/java/pom.xml
    incubator/tuscany/java/sca/bindings/binding.celtix/pom.xml
    incubator/tuscany/java/sca/pom.xml

Added: incubator/tuscany/java/buildtools/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/buildtools/pom.xml?rev=407916&view=auto
==============================================================================
--- incubator/tuscany/java/buildtools/pom.xml (added)
+++ incubator/tuscany/java/buildtools/pom.xml Fri May 19 14:36:34 2006
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *  Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.tuscany</groupId>
+    <artifactId>tuscany-buildtools</artifactId>
+    <packaging>jar</packaging>
+    <name>Tuscany Build Tools</name>
+    <version>incubating-M1</version>
+</project>

Propchange: incubator/tuscany/java/buildtools/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/buildtools/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/buildtools/src/main/resources/tuscany-checkstyle.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/buildtools/src/main/resources/tuscany-checkstyle.xml?rev=407916&view=auto
==============================================================================
--- incubator/tuscany/java/buildtools/src/main/resources/tuscany-checkstyle.xml (added)
+++ incubator/tuscany/java/buildtools/src/main/resources/tuscany-checkstyle.xml Fri May 19 14:36:34 2006
@@ -0,0 +1,285 @@
+<?xml version="1.0"?>
+<!--
+  Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+  Licensed 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.
+ -->
+<!DOCTYPE module PUBLIC
+        "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+        "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<!--
+Checks to make sure the code meets the Tuscany coding guidelines
+http://java.sun.com/docs/codeconv/index.html
+
+It also enforces aa bunch of other "BestPractices like method
+lengths, if/try depths, etc...
+                        
+-->
+
+<module name="Checker">
+    <property name="severity"
+             value="${checkstyle.severity}"
+             default="warning"/>
+
+    <!-- Checks whether files end with a new line.                        -->
+    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+    <!--
+    <module name="NewlineAtEndOfFile"/>
+    -->
+
+    <!-- Checks that property files contain the same keys.         -->
+    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+    <module name="Translation"/>
+
+    <!--<module name="StrictDuplicateCode"/>-->
+
+    <module name="TreeWalker">
+
+        <!-- Checks for Javadoc comments.                     -->
+        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+        <!--
+        <module name="PackageHtml"/>
+        <module name="JavadocMethod"/>
+        <module name="JavadocType"/>
+        <module name="JavadocVariable"/>
+        <module name="JavadocStyle"/>
+        -->
+
+
+        <!-- Checks for Naming Conventions.                  -->
+        <!-- See http://checkstyle.sf.net/config_naming.html -->
+        <module name="AbstractClassName">
+            <property name="format"
+                      value="^Abstract.*$|^.*Factory$|^.*Bus$|^.*ConfigurationRepository$|^.*Base$|^Exception$|^.*Builder$"/>
+        </module>
+        <module name="ConstantName"/>
+        <module name="LocalFinalVariableName"/>
+        <module name="LocalVariableName"/>
+        <module name="MemberName"/>
+        <module name="MethodName"/>
+        <module name="PackageName"/>
+        <module name="ParameterName"/>
+        <module name="StaticVariableName"/>
+        <module name="TypeName"/>
+
+        <!-- Header checks -->
+        <!-- <module name="Header"/> -->
+        <!-- <module name="RegexpHeader"/> -->
+
+
+        <!-- Checks for imports                              -->
+        <!-- See http://checkstyle.sf.net/config_import.html -->
+        <module name="AvoidStarImport">
+            <property name="excludes"
+                      value="java.io,java.util,java.net,java.nio,java.nio.channels,java.lang.reflect,org.w3c.dom,org.xml.sax,java.awt,javax.swing,junit.framework"/>
+        </module>
+        <module name="IllegalImport"/>
+        <!-- defaults to sun.* packages -->
+        <module name="RedundantImport"/>
+        <module name="UnusedImports"/>
+        <module name="ImportOrder">
+            <property name="groups" value="java,javax,org.w3c,org.xml,w3c"/>
+            <property name="ordered" value="true"/>
+        </module>
+        <!--
+        <module name="ImportControl">
+            <property name="file" value="etc/import-control.xml"/>
+        </module>
+        -->
+
+
+        <!-- Checks for Size Violations.                    -->
+        <!-- See http://checkstyle.sf.net/config_sizes.html -->
+        <module name="AnonInnerLength">
+            <property name="max" value="40"/>
+        </module>
+        <module name="ExecutableStatementCount">
+            <property name="max" value="50"/>
+        </module>
+        <module name="FileLength"/>
+        <module name="LineLength">
+            <property name="max" value="115"/>
+        </module>
+        <module name="MethodLength">
+            <property name="max" value="150"/>
+            <property name="countEmpty" value="false"/>
+        </module>
+        <module name="ParameterNumber">
+            <property name="max" value="7"/>
+        </module>
+
+        <!-- Checks for whitespace                               -->
+        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+        <module name="EmptyForIteratorPad"/>
+        <module name="EmptyForInitializerPad"/>
+        <module name="MethodParamPad"/>
+        <module name="NoWhitespaceAfter">
+            <property name="tokens" value="ARRAY_INIT,BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
+        </module>
+        <module name="NoWhitespaceBefore"/>
+        <module name="OperatorWrap"/>
+        <module name="ParenPad"/>
+        <module name="TypecastParenPad"/>
+        <module name="TabCharacter"/>
+        <module name="WhitespaceAfter">
+            <property name="tokens" value="COMMA, SEMI"/>
+        </module>
+        <module name="WhitespaceAround">
+            <property name="tokens"
+                      value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,TYPE_EXTENSION_AND"/>
+        </module>
+
+
+        <!-- Modifier Checks                                    -->
+        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+        <module name="ModifierOrder"/>
+        <module name="RedundantModifier"/>
+
+
+        <!-- Checks for blocks. You know, those {}'s         -->
+        <!-- See http://checkstyle.sf.net/config_blocks.html -->
+        <module name="AvoidNestedBlocks">
+            <property name="allowInSwitchCase" value="true"/>
+        </module>
+        <module name="EmptyBlock">
+            <property name="option" value="text"/>
+        </module>
+        <module name="LeftCurly"/>
+        <module name="NeedBraces"/>
+        <module name="RightCurly"/>
+
+
+        <!-- Checks for common coding problems               -->
+        <!-- See http://checkstyle.sf.net/config_coding.html -->
+        <!--<module name="ArrayTrailingComma"/>-->
+        <!--<module name="AvoidInlineConditionals"/>-->
+        <module name="CovariantEquals"/>
+        <module name="DoubleCheckedLocking"/>
+        <module name="EmptyStatement"/>
+        <module name="EqualsHashCode"/>
+        <!--<module name="FinalLocalVariable"/>-->
+        <module name="HiddenField">
+    	    <property name="ignoreConstructorParameter" value="true"/>
+    	    <property name="ignoreSetter" value="true"/>
+    	    <property name="ignoreAbstractMethods" value="true"/>
+        </module>
+        <module name="IllegalInstantiation"/>
+        <!--<module name="IllegalToken"/>-->
+        <!--<module name="IllegalTokenText"/>-->
+        <!--<module name="InnerAssignment"/>-->
+        <!--<module name="MagicNumber"/>-->
+        <module name="MissingSwitchDefault"/>
+        <module name="ModifiedControlVariable"/>
+        <module name="SimplifyBooleanExpression"/>
+        <module name="SimplifyBooleanReturn"/>
+        <module name="StringLiteralEquality"/>
+        <module name="NestedIfDepth">
+            <property name="max" value="3"/>
+        </module>
+        <module name="NestedTryDepth">
+            <property name="max" value="3"/>
+        </module>
+        <module name="SuperClone"/>
+        <module name="SuperFinalize"/>
+        <!--<module name="IllegalCatch"/>-->
+        <module name="IllegalThrows">
+            <property name="illegalClassNames" value="java.lang.Error,java.lang.RuntimeException"/>
+        </module>
+        <!--<module name="RedundantThrows"/>-->
+        <module name="PackageDeclaration"/>
+        <module name="JUnitTestCase"/>
+        <module name="ReturnCount">
+            <property name="max" value="6"/>
+        </module>
+
+        <module name="IllegalType">
+            <property name="format" value="^xxx$"/>
+        </module>
+        <module name="DeclarationOrder"/>
+        <!--<module name="ParameterAssignment"/>-->
+        <module name="ExplicitInitialization"/>
+        <module name="DefaultComesLast"/>
+        <!--<module name="MissingCtor"/>-->
+        <module name="FallThrough"/>
+        <!--<module name="MultipleStringLiterals"/>-->
+        <module name="MultipleVariableDeclarations"/>
+        <!--<module name="RequireThis"/>-->
+        <module name="UnnecessaryParentheses"/>
+
+
+        <!-- Checks for class design                         -->
+        <!-- See http://checkstyle.sf.net/config_design.html -->
+        <!--<module name="DesignForExtension"/>-->
+        <module name="FinalClass"/>
+        <module name="HideUtilityClassConstructor"/>
+        <module name="InterfaceIsType"/>
+        <module name="MutableException"/>
+        <module name="ThrowsCount">
+            <property name="max" value="5"/>
+        </module>
+        <module name="VisibilityModifier">
+            <property name="protectedAllowed" value="true"/>
+            <property name="packageAllowed" value="true"/>
+        </module>
+
+
+        <!-- Metrics checks.                   -->
+        <!-- See http://checkstyle.sf.net/config_metrics.html -->
+        <module name="BooleanExpressionComplexity">
+            <property name="max" value="6"/>
+        </module>
+        <!--<module name="ClassDataAbstractionCoupling"/>-->
+        <!--<module name="ClassFanOutComplexity"/>-->
+        <!--<module name="CyclomaticComplexity"/>-->
+        <!--<module name="NPathComplexity"/>-->
+        <module name="JavaNCSS">
+            <property name="methodMaximum" value="75"/>
+        </module>
+
+
+        <!-- Miscellaneous other checks.                   -->
+        <!-- See http://checkstyle.sf.net/config_misc.html -->
+        <!-- 
+        <module name="ArrayTypeStyle"/>
+        <module name="FinalParameters"/>
+        -->
+        <!--
+        <module name="GenericIllegalRegexp">
+            <property name="format" value="\s+$"/>
+            <property name="message" value="Line has trailing spaces."/>
+        </module>
+        -->
+        <module name="TodoComment">
+            <property name="format" value="WARNING"/>
+        </module>
+
+        <module name="UpperEll"/>
+
+        <!--Assert statement may have side effects:-->
+        <module name="DescendantToken">
+            <property name="tokens" value="LITERAL_ASSERT"/>
+            <property name="limitedTokens"
+                      value="ASSIGN,DEC,INC,POST_DEC,POST_INC,PLUS_ASSIGN,MINUS_ASSIGN,STAR_ASSIGN,DIV_ASSIGN,MOD_ASSIGN,BSR_ASSIGN,SR_ASSIGN,SL_ASSIGN,BAND_ASSIGN,BXOR_ASSIGN,BOR_ASSIGN"/>
+            <property name="maximumNumber" value="0"/>
+        </module>
+
+        <!--<module name="UncommentedMain"/>-->
+        <module name="TrailingComment"/>
+        <module name="Indentation">
+            <property name="caseIndent" value="0"/>
+        </module>
+        <!--<module name="RequiredRegexp">-->
+    </module>
+
+</module>

Propchange: incubator/tuscany/java/buildtools/src/main/resources/tuscany-checkstyle.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/buildtools/src/main/resources/tuscany-checkstyle.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/tuscany/java/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/pom.xml?rev=407916&r1=407915&r2=407916&view=diff
==============================================================================
--- incubator/tuscany/java/pom.xml (original)
+++ incubator/tuscany/java/pom.xml Fri May 19 14:36:34 2006
@@ -14,7 +14,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  -->
-<project>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.tuscany</groupId>
     <artifactId>tuscany-project</artifactId>
@@ -57,6 +60,7 @@
     </repositories>
 
     <modules>
+        <module>buildtools</module>
         <module>spec</module>
         <module>sdo</module>
         <module>das</module>
@@ -124,6 +128,43 @@
                 <version>1.0-alpha-5</version>
             </extension>
         </extensions>
+
+
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-checkstyle-plugin</artifactId>
+                    <dependencies>
+                        <dependency>
+                            <groupId>org.apache.tuscany</groupId>
+                            <artifactId>tuscany-buildtools</artifactId>
+                            <version>${pom.version}</version>
+                        </dependency>
+                    </dependencies>
+                    <executions>
+                        <execution>
+                            <id>process-sources</id>
+                            <phase>process-sources</phase>
+                            <configuration>
+                                <configLocation>tuscany-checkstyle.xml</configLocation>
+                                <consoleOutput>true</consoleOutput>
+                                <failsOnError>true</failsOnError>
+                                <linkXRef>false</linkXRef>
+                                <sourceDirectory>${basedir}/src</sourceDirectory>
+                                <propertyExpansion>
+                                ${checkstyle.properties}
+                                </propertyExpansion>
+                            </configuration>
+                            <goals>
+                                <goal>checkstyle</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
     </build>
 
 
@@ -145,7 +186,40 @@
         </plugins>
     </reporting>
 
+
     <profiles>
+        <profile>
+            <!-- basic profile with no checks or anything... -->
+            <id>basic</id>
+        </profile>
+
+        <profile>
+            <id>sourcecheck</id>
+            <!--
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            -->
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-checkstyle-plugin</artifactId>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <configuration>
+                            <source>1.5</source>
+                            <target>1.5</target>
+                            <showDeprecation>true</showDeprecation>
+                            <compilerArgument>-Xlint:unchecked,deprecation,fallthrough,finally</compilerArgument>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+
+        </profile>
         <profile>
             <id>distribution</id>
 

Modified: incubator/tuscany/java/sca/bindings/binding.celtix/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.celtix/pom.xml?rev=407916&r1=407915&r2=407916&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.celtix/pom.xml (original)
+++ incubator/tuscany/java/sca/bindings/binding.celtix/pom.xml Fri May 19 14:36:34 2006
@@ -14,7 +14,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  -->
-<project>
+<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">
 
     <parent>
         <groupId>org.apache.tuscany.sca.bindings</groupId>
@@ -30,7 +32,8 @@
 
     <properties>
         <celtix.version>1.0</celtix.version>
-        <compiler.flags>-Xlint:unchecked,deprecation,fallthrough,finally</compiler.flags>
+        <checkstyle.properties>checkstyle.severity=error</checkstyle.properties>
+        <sourcechecks.force>true</sourcechecks.force>
     </properties>
     <repositories>
         <repository>
@@ -74,6 +77,8 @@
         </dependency>
 									
 
+
+
         <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymockclassextension</artifactId>
@@ -93,55 +98,31 @@
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.5</source>
-                    <target>1.5</target>
-                    <showDeprecation>true</showDeprecation>
-                    <compilerArgument>${compile.flags}</compilerArgument>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>process-sources</id>
-                        <phase>process-sources</phase>
-                        <configuration>
-                            <configLocation>${basedir}/checkstyle.xml</configLocation>
-                            <consoleOutput>true</consoleOutput>
-                            <failsOnError>true</failsOnError>
-                        </configuration>
-                        <goals>
-                            <goal>checkstyle</goal>
-                        </goals>
-                    </execution>
-                </executions>
             </plugin>
 
-            <!-- This won't work until 2.0 of PMD plugin is released
+
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-pmd-plugin</artifactId>
+                <configuration>
+                    <rulesets>
+                        <ruleset>${basedir}/.ruleset</ruleset>
+                    </rulesets>
+                    <linkXRef>false</linkXRef>
+
+                    <targetJdk>1.5</targetJdk>
+                </configuration>
                 <executions>
                     <execution>
                         <id>process-sources</id>
                         <phase>process-sources</phase>
-                        <configuration>
-                            <targetJdk>1.5</targetJdk>
-                            <rulesets>
-                                <ruleset>.ruleset</ruleset>
-                            </rulesets>
-                            <failOnViolation>true</failOnViolation>
-                        </configuration>
                         <goals>
                             <goal>check</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
-            -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-eclipse-plugin</artifactId>

Modified: incubator/tuscany/java/sca/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/pom.xml?rev=407916&r1=407915&r2=407916&view=diff
==============================================================================
--- incubator/tuscany/java/sca/pom.xml (original)
+++ incubator/tuscany/java/sca/pom.xml Fri May 19 14:36:34 2006
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  -->
-<project>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <parent>
         <groupId>org.apache.tuscany</groupId>
         <artifactId>tuscany-project</artifactId>



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org