You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by vr...@apache.org on 2015/09/26 06:11:20 UTC

[02/34] incubator-apex-core git commit: APEX-16 #comment #resolve added checkstyle rules to enforce common style

APEX-16 #comment #resolve added checkstyle rules to enforce common style


Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/commit/eb0e9286
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/tree/eb0e9286
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/diff/eb0e9286

Branch: refs/heads/feature-module
Commit: eb0e9286106c778da02eed858b521cca39bcf30e
Parents: 507fac3
Author: Chandni Singh <ch...@datatorrent.com>
Authored: Mon Aug 10 22:48:02 2015 -0700
Committer: Chandni Singh <cs...@apache.org>
Committed: Wed Sep 23 20:04:27 2015 -0700

----------------------------------------------------------------------
 api/pom.xml          |   7 +++
 bufferserver/pom.xml |  12 +++++
 common/pom.xml       |   7 +++
 dt_checks.xml        | 128 ++++++++++++++++++++++++++++++++++++++++++++++
 engine/pom.xml       |   7 +++
 pom.xml              |  20 ++++++++
 6 files changed, 181 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/eb0e9286/api/pom.xml
----------------------------------------------------------------------
diff --git a/api/pom.xml b/api/pom.xml
index a35d934..70b3c65 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -65,6 +65,13 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <maxAllowedViolations>46</maxAllowedViolations>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   <dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/eb0e9286/bufferserver/pom.xml
----------------------------------------------------------------------
diff --git a/bufferserver/pom.xml b/bufferserver/pom.xml
index ffd6ca3..e1878cb 100644
--- a/bufferserver/pom.xml
+++ b/bufferserver/pom.xml
@@ -33,6 +33,18 @@
     </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <maxAllowedViolations>139</maxAllowedViolations>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
   <profiles>
     <profile>
       <id>netbeans-private-testng</id>

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/eb0e9286/common/pom.xml
----------------------------------------------------------------------
diff --git a/common/pom.xml b/common/pom.xml
index ad564b1..1940c5c 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -50,6 +50,13 @@
           </execution>
         </executions>
       </plugin>
+    <plugin>
+      <groupId>org.apache.maven.plugins</groupId>
+      <artifactId>maven-checkstyle-plugin</artifactId>
+      <configuration>
+        <maxAllowedViolations>88</maxAllowedViolations>
+      </configuration>
+    </plugin>
   </plugins>
   </build>
 

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/eb0e9286/dt_checks.xml
----------------------------------------------------------------------
diff --git a/dt_checks.xml b/dt_checks.xml
new file mode 100644
index 0000000..f7967e6
--- /dev/null
+++ b/dt_checks.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+  "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+  "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<module name="Checker">
+  <property name="charset" value="UTF-8"/>
+
+  <module name="FileTabCharacter">
+    <property name="eachLine" value="true"/>
+  </module>
+
+  <module name="NewlineAtEndOfFile">
+    <property name="lineSeparator" value="lf"/>
+  </module>
+
+  <module name="RegexpMultiline">
+    <property name="format" value="System\.(out)|(err)\.print(ln)?\("/>
+  </module>
+
+  <module name="TreeWalker">
+    <module name="OneTopLevelClass"/>
+    <!-- checks package and import stmts are not line wrapped -->
+    <module name="NoLineWrap"/>
+
+    <module name="EmptyBlock">
+      <property name="option" value="TEXT"/>
+      <property name="tokens"
+                value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
+    </module>
+    <!-- checks for braces around code blocks -->
+    <module name="NeedBraces"/>
+
+    <module name="LeftCurly">
+      <property name="option" value="eol"/>
+      <property name="tokens"
+                value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE"/>
+    </module>
+
+    <module name="LeftCurly">
+      <property name="option" value="nl"/>
+      <property name="tokens"
+                value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_DEF, ENUM_CONSTANT_DEF, INTERFACE_DEF, METHOD_DEF, STATIC_INIT "/>
+    </module>
+
+    <module name="RightCurly">
+      <property name="option" value="same"/>
+      <property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE"/>
+    </module>
+
+    <module name="RightCurly">
+      <property name="option" value="alone"/>
+      <property name="tokens"
+                value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
+    </module>
+
+    <module name="NoWhitespaceAfter">
+      <property name="tokens"
+                value="ARRAY_INIT, BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS, TYPECAST, ARRAY_DECLARATOR"/>
+    </module>
+
+    <module name="NoWhitespaceBefore">
+      <property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
+    </module>
+
+    <module name="WhitespaceAround">
+      <property name="allowEmptyConstructors" value="true"/>
+      <property name="allowEmptyMethods" value="true"/>
+      <property name="allowEmptyTypes" value="true"/>
+      <property name="allowEmptyLoops" value="true"/>
+      <message key="ws.notFollowed" value="WhitespaceAround: ''{0}'' is not followed by whitespace."/>
+      <message key="ws.notPreceded" value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
+    </module>
+
+    <module name="OneStatementPerLine"/>
+    <module name="MultipleVariableDeclarations"/>
+    <module name="ArrayTypeStyle"/>
+    <module name="MissingSwitchDefault"/>
+
+    <!-- If the logic requires fallthrough then the text "fallthru", "fall through", "fallthrough",
+     "falls through" and "fallsthrough" can be placed as a comment after the last line of the case -->
+    <module name="FallThrough"/>
+
+    <module name="UpperEll"/>
+    <module name="ModifierOrder"/>
+    <module name="EmptyLineSeparator">
+      <property name="tokens"
+                value="IMPORT, CLASS_DEF, ENUM_DEF, INTERFACE_DEF, CTOR_DEF, METHOD_DEF, STATIC_INIT, INSTANCE_INIT"/>
+    </module>
+    <module name="SeparatorWrap">
+      <property name="tokens" value="DOT"/>
+      <property name="option" value="nl"/>
+    </module>
+
+    <module name="SeparatorWrap">
+      <property name="tokens" value="COMMA"/>
+      <property name="option" value="EOL"/>
+    </module>
+
+    <module name="NoFinalizer"/>
+    <module name="GenericWhitespace">
+      <message key="ws.followed"
+               value="GenericWhitespace ''{0}'' is followed by whitespace."/>
+      <message key="ws.preceded"
+               value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
+      <message key="ws.illegalFollow"
+               value="GenericWhitespace ''{0}'' should be followed by whitespace."/>
+      <message key="ws.notPreceded"
+               value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
+    </module>
+
+    <module name="Indentation">
+      <property name="basicOffset" value="2"/>
+      <property name="braceAdjustment" value="0"/>
+      <property name="caseIndent" value="2"/>
+    </module>
+
+    <module name="CustomImportOrder">
+      <property name="thirdPartyPackageRegExp" value=".*"/>
+      <property name="specialImportsRegExp" value="com.datatorrent"/>
+      <property name="sortImportsInGroupAlphabetically" value="true"/>
+      <property name="customImportOrderRules"
+                value="STATIC###STANDARD_JAVA_PACKAGE###THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS"/>
+    </module>
+    <module name="MethodParamPad"/>
+  </module>
+
+</module>

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/eb0e9286/engine/pom.xml
----------------------------------------------------------------------
diff --git a/engine/pom.xml b/engine/pom.xml
index 2b8f66a..21515a4 100644
--- a/engine/pom.xml
+++ b/engine/pom.xml
@@ -121,6 +121,13 @@
           <!--downloadJavadocs>true</downloadJavadocs-->
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <maxAllowedViolations>2385</maxAllowedViolations>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/eb0e9286/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index fc0983f..ba64390 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,6 +46,7 @@
     <jetty.version>8.1.10.v20130312</jetty.version>
     <maven.deploy.repo.classifier></maven.deploy.repo.classifier>
     <license.skip>true</license.skip>
+    <checkstyle.console>false</checkstyle.console>
   </properties>
 
   <dependencies>
@@ -246,6 +247,25 @@
             </execution>
           </executions>
         </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <version>2.16</version>
+          <executions>
+            <execution>
+              <id>checkstyle</id>
+              <phase>validate</phase>
+              <goals>
+                <goal>check</goal>
+              </goals>
+              <configuration>
+                <failOnViolation>true</failOnViolation>
+                <configLocation>dt_checks.xml</configLocation>
+                <logViolationsToConsole>${checkstyle.console}</logViolationsToConsole>
+              </configuration>
+            </execution>
+          </executions>
+        </plugin>
       </plugins>
     </pluginManagement>
     <extensions>