[PATCH 5 of 5] Add Checkstyle configuration

Wald Commits scm-commit at wald.intevation.org
Thu Jan 18 20:57:42 CET 2018


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1516305243 -3600
# Branch 3.2.x
# Node ID 0862ea5d66baf60e7eee496d130a35157cc9ec12
# Parent  a805211690f7ee505a348385723af4f213445a1d
Add Checkstyle configuration.

diff -r a805211690f7 -r 0862ea5d66ba artifacts/pom.xml
--- a/artifacts/pom.xml	Thu Jan 18 20:52:41 2018 +0100
+++ b/artifacts/pom.xml	Thu Jan 18 20:54:03 2018 +0100
@@ -42,6 +42,28 @@
           </descriptors>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>3.0.0</version>
+        <configuration>
+          <configLocation>../checkstyle.xml</configLocation>
+          <encoding>UTF-8</encoding>
+        </configuration>
+        <executions>
+          <execution>
+            <id>validate</id>
+            <phase>validate</phase>
+            <configuration>
+              <consoleOutput>true</consoleOutput>
+              <failsOnError>true</failsOnError>
+            </configuration>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
diff -r a805211690f7 -r 0862ea5d66ba backend/pom.xml
--- a/backend/pom.xml	Thu Jan 18 20:52:41 2018 +0100
+++ b/backend/pom.xml	Thu Jan 18 20:54:03 2018 +0100
@@ -82,6 +82,28 @@
           </descriptors>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>3.0.0</version>
+        <configuration>
+          <configLocation>../checkstyle.xml</configLocation>
+          <encoding>UTF-8</encoding>
+        </configuration>
+        <executions>
+          <execution>
+            <id>validate</id>
+            <phase>validate</phase>
+            <configuration>
+              <consoleOutput>true</consoleOutput>
+              <failsOnError>true</failsOnError>
+            </configuration>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
diff -r a805211690f7 -r 0862ea5d66ba checkstyle.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/checkstyle.xml	Thu Jan 18 20:54:03 2018 +0100
@@ -0,0 +1,159 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<module name="Checker">
+
+  <!-- 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="FileLength"/>
+
+  <!-- Following interprets the header file as regular expressions. -->
+  <module name="RegexpHeader">
+    <property name="headerFile" value="../java.header"/>
+    <property name="fileExtensions" value="java"/>
+  </module>
+
+  <module name="FileTabCharacter">
+    <property name="eachLine" value="true"/>
+  </module>
+
+  <module name="RegexpSingleline">
+    <!-- \s matches whitespace character, $ matches end of line. -->
+    <property name="format" value="\s+$"/>
+    <property name="message" value="Line has trailing spaces."/>
+  </module>
+
+  <module name="TreeWalker">
+
+    <property name="cacheFile" value="${checkstyle.cache.file}"/>
+
+    <!-- required for SuppressWarningsFilter (and other Suppress* rules not used here) -->
+    <!-- see http://checkstyle.sourceforge.net/config_annotation.html#SuppressWarningsHolder -->
+    <module name="SuppressWarningsHolder"/>
+
+    <!-- Checks for Naming Conventions.                  -->
+    <!-- See http://checkstyle.sf.net/config_naming.html -->
+    <!--<module name="ConstantName">
+      <property name="format" value="log|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
+    </module>
+    <module name="LocalFinalVariableName"/>
+    <module name="LocalVariableName">
+      <property name="format" value="^[a-z][_a-zA-Z0-9]*$"/>
+    </module>
+    <module name="MemberName">
+      <property name="format" value="^[a-zA-Z][_a-zA-Z0-9]*$"/>
+    </module>
+    <module name="MethodName"/>
+    <module name="PackageName"/>
+    <module name="ParameterName">
+      <property name="format" value="^[a-zA-Z][_a-zA-Z0-9]*$"/>
+    </module>
+    <module name="StaticVariableName"/>
+    <module name="TypeName"/>-->
+
+
+    <!-- Checks for imports                              -->
+    <!-- See http://checkstyle.sf.net/config_import.html -->
+    <module name="AvoidStarImport"/>
+    <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
+    <module name="RedundantImport"/>
+    <module name="UnusedImports"/>
+
+
+    <!-- Checks for Size Violations.                    -->
+    <!-- See http://checkstyle.sf.net/config_sizes.html -->
+    <module name="LineLength">
+      <property name="ignorePattern" value="^ *\$wnd.*$"/>
+    </module>
+
+
+    <!-- Checks for whitespace                               -->
+    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+    <!--<module name="EmptyForIteratorPad"/>
+    <module name="MethodParamPad">
+      <property name="tokens"
+                value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL"/>
+    </module>
+    <module name="NoWhitespaceAfter">
+      <property name="tokens"
+                value="INC,DEC,UNARY_MINUS,UNARY_PLUS,BNOT,LNOT,DOT,INDEX_OP"/>
+    </module>
+    <module name="NoWhitespaceBefore"/>
+    <module name="OperatorWrap"/>
+    <module name="ParenPad">
+      <property name="tokens"
+                value="ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, LITERAL_NEW, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL, METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL"/>
+    </module>
+    <module name="TypecastParenPad"/>
+    <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_ASSIGN, DO_WHILE, EQUAL, LAMBDA, LAND, LCURLY, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, MINUS_ASSIGN, MOD_ASSIGN, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR_ASSIGN, LITERAL_ASSERT, 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"/>-->
+    <!--<module name="EmptyBlock"/>-->
+    <!--<module name="LeftCurly"/>-->
+    <!--<module name="NeedBraces"/>-->
+    <!--<module name="RightCurly"/>-->
+
+
+    <!-- Checks for common coding problems               -->
+    <!-- See http://checkstyle.sf.net/config_coding.html -->
+    <!-- module name="EmptyStatement"/ -->
+    <!--<module name="EqualsHashCode"/>-->
+    <!--<module name="HiddenField">
+      <property name="ignoreConstructorParameter" value="true"/>
+      <property name="ignoreSetter" value="true"/>
+    </module>-->
+    <module name="IllegalInstantiation"/>
+    <!--<module name="InnerAssignment"/>-->
+    <!--<module name="MagicNumber"/>-->
+    <!--<module name="MissingSwitchDefault"/>-->
+    <!--<module name="SimplifyBooleanExpression"/>-->
+    <!--<module name="SimplifyBooleanReturn"/>-->
+
+    <!-- Checks for class design                         -->
+    <!-- See http://checkstyle.sf.net/config_design.html -->
+    <!--<module name="HideUtilityClassConstructor"/>-->
+    <!--<module name="InterfaceIsType"/>-->
+
+
+    <!-- Miscellaneous other checks.                   -->
+    <!-- See http://checkstyle.sf.net/config_misc.html -->
+    <!--<module name="ArrayTypeStyle"/>-->
+    <!-- Uncomment this if you want to track open TODOs.
+         <module name="TodoComment"/>
+    -->
+    <module name="UpperEll"/>
+
+  </module>
+
+  <!-- Support @SuppressWarnings (added in Checkstyle 5.7) -->
+  <!-- see http://checkstyle.sourceforge.net/config.html#SuppressWarningsFilter -->
+  <module name="SuppressWarningsFilter"/>
+
+  <!-- Checks properties file for a duplicated properties. -->
+  <!-- See http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties -->
+  <module name="UniqueProperties"/>
+
+</module>
diff -r a805211690f7 -r 0862ea5d66ba gwt-client/pom.xml
--- a/gwt-client/pom.xml	Thu Jan 18 20:52:41 2018 +0100
+++ b/gwt-client/pom.xml	Thu Jan 18 20:54:03 2018 +0100
@@ -225,6 +225,29 @@
         </configuration>
       </plugin>
 
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>3.0.0</version>
+        <configuration>
+          <configLocation>../checkstyle.xml</configLocation>
+          <encoding>UTF-8</encoding>
+        </configuration>
+        <executions>
+          <execution>
+            <id>validate</id>
+            <phase>validate</phase>
+            <configuration>
+              <consoleOutput>true</consoleOutput>
+              <failsOnError>true</failsOnError>
+            </configuration>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
     </plugins>
     </build>
       <repositories>
diff -r a805211690f7 -r 0862ea5d66ba java.header
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/java.header	Thu Jan 18 20:54:03 2018 +0100
@@ -0,0 +1,7 @@
+^/\* Copyright \(C\) .* by Bundesanstalt für Gewässerkunde$
+^ \* Software engineering by .*$
+^ \*$
+^ \* This file is Free Software under the GNU AGPL \(>=v3\)$
+^ \* and comes with ABSOLUTELY NO WARRANTY! Check out the$
+^ \* documentation coming with Dive4Elements River for details.$
+^ \*/$


More information about the Dive4Elements-commits mailing list