Checkstyle: preparation for switching to odlparent 69/40969/3
authorLorand Jakab <lojakab@cisco.com>
Tue, 28 Jun 2016 21:25:06 +0000 (16:25 -0500)
committerLorand Jakab <lojakab@cisco.com>
Wed, 29 Jun 2016 15:04:19 +0000 (10:04 -0500)
There has been a lot of work on the ODL-wide checkstyle rules in
odlparent, and we should eventually be compliant. To be able to make
progress on individial bundles, this commit moves our custom checkstyle
enabler from mappingservice/pom.xml to the individual child poms. As an
example, mappingservice/shell is updated to comply with ODL checkstyle
rules and turns on enforcement. Additionally, it contains a violation
that is inevitable, and code to suppress than one particular violation.
That can be used as an example in other places where there is good
reason not to follow ODL style.

Change-Id: I3455f4084fa1302f8a970b2dfba0b9293767aecf
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
mappingservice/api/pom.xml
mappingservice/dsbackend/pom.xml
mappingservice/implementation/pom.xml
mappingservice/inmemorydb/pom.xml
mappingservice/mapcache/pom.xml
mappingservice/pom.xml
mappingservice/shell/pom.xml
mappingservice/shell/src/main/java/org/opendaylight/lispflowmapping/shell/LispAddKey.java
mappingservice/shell/src/main/java/org/opendaylight/lispflowmapping/shell/LispMappings.java
mappingservice/southbound/pom.xml

index 45e49931bcb7cfc04b967cffaa5baedbf62f15c1..496fd1154225c700d111e8bdb54cb4d09df76cb4 100644 (file)
     </dependency>
   </dependencies>
 
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <!-- Temporarily override the odlparent checkstyle configuration.
+               We want to enforce some simple rules and add more as we clean up code -->
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <configuration>
+            <configLocation>checkstyle/java_rules.xml</configLocation>
+            <includeTestSourceDirectory>true</includeTestSourceDirectory>
+            <excludes>org/opendaylight/yang/gen/**,**/config/yang/**</excludes>
+            <failsOnError>true</failsOnError>
+            <consoleOutput>true</consoleOutput>
+          </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>org.opendaylight.lispflowmapping</groupId>
+              <artifactId>common.build.tools</artifactId>
+              <version>${project.version}</version>
+            </dependency>
+          </dependencies>
+          <executions>
+            <execution>
+              <goals>
+                <goal>check</goal>
+              </goals>
+              <phase>process-sources</phase>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
   <!--
       Maven Site Configuration
 
index 14e75da8d9988135da4597d80b249e7daa9ee0c4..34789a5aa9e4fdb8845dbeb8b044cc0a69082617 100644 (file)
 
   </dependencies>
 
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <!-- Temporarily override the odlparent checkstyle configuration.
+               We want to enforce some simple rules and add more as we clean up code -->
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <configuration>
+            <configLocation>checkstyle/java_rules.xml</configLocation>
+            <includeTestSourceDirectory>true</includeTestSourceDirectory>
+            <excludes>org/opendaylight/yang/gen/**,**/config/yang/**</excludes>
+            <failsOnError>true</failsOnError>
+            <consoleOutput>true</consoleOutput>
+          </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>org.opendaylight.lispflowmapping</groupId>
+              <artifactId>common.build.tools</artifactId>
+              <version>${project.version}</version>
+            </dependency>
+          </dependencies>
+          <executions>
+            <execution>
+              <goals>
+                <goal>check</goal>
+              </goals>
+              <phase>process-sources</phase>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
   <!--
       Maven Site Configuration
 
index 70233c1c40b0a06cd3efb6a849c72dbe2056bc48..51895d004c66dbb2bcfdef6393ee74d5bbbf73df 100644 (file)
     </dependency>
   </dependencies>
 
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <!-- Temporarily override the odlparent checkstyle configuration.
+               We want to enforce some simple rules and add more as we clean up code -->
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <configuration>
+            <configLocation>checkstyle/java_rules.xml</configLocation>
+            <includeTestSourceDirectory>true</includeTestSourceDirectory>
+            <excludes>org/opendaylight/yang/gen/**,**/config/yang/**</excludes>
+            <failsOnError>true</failsOnError>
+            <consoleOutput>true</consoleOutput>
+          </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>org.opendaylight.lispflowmapping</groupId>
+              <artifactId>common.build.tools</artifactId>
+              <version>${project.version}</version>
+            </dependency>
+          </dependencies>
+          <executions>
+            <execution>
+              <goals>
+                <goal>check</goal>
+              </goals>
+              <phase>process-sources</phase>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
   <!--
       Maven Site Configuration
 
index 47a8934ed3beb5681ee622b057868316ac2d93fc..d7bd393e17c72a431d6038d56f653351ed9b12cc 100644 (file)
     </dependency>
   </dependencies>
 
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <!-- Temporarily override the odlparent checkstyle configuration.
+               We want to enforce some simple rules and add more as we clean up code -->
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <configuration>
+            <configLocation>checkstyle/java_rules.xml</configLocation>
+            <includeTestSourceDirectory>true</includeTestSourceDirectory>
+            <excludes>org/opendaylight/yang/gen/**,**/config/yang/**</excludes>
+            <failsOnError>true</failsOnError>
+            <consoleOutput>true</consoleOutput>
+          </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>org.opendaylight.lispflowmapping</groupId>
+              <artifactId>common.build.tools</artifactId>
+              <version>${project.version}</version>
+            </dependency>
+          </dependencies>
+          <executions>
+            <execution>
+              <goals>
+                <goal>check</goal>
+              </goals>
+              <phase>process-sources</phase>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
   <!--
       Maven Site Configuration
 
index 7c3e04a587e3e48831f5baa414b85a81ce9f9458..6e51050c5ec6cc6dea51b448b81f63b3fd3009cd 100644 (file)
     </dependency>
   </dependencies>
 
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <!-- Temporarily override the odlparent checkstyle configuration.
+               We want to enforce some simple rules and add more as we clean up code -->
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <configuration>
+            <configLocation>checkstyle/java_rules.xml</configLocation>
+            <includeTestSourceDirectory>true</includeTestSourceDirectory>
+            <excludes>org/opendaylight/yang/gen/**,**/config/yang/**</excludes>
+            <failsOnError>true</failsOnError>
+            <consoleOutput>true</consoleOutput>
+          </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>org.opendaylight.lispflowmapping</groupId>
+              <artifactId>common.build.tools</artifactId>
+              <version>${project.version}</version>
+            </dependency>
+          </dependencies>
+          <executions>
+            <execution>
+              <goals>
+                <goal>check</goal>
+              </goals>
+              <phase>process-sources</phase>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
   <!--
       Maven Site Configuration
 
index 8e9c67d896295094238d5a9aacac5c96b0d22a66..0f481a6d2bc2ec309eed5639b210333550dfbfcb 100644 (file)
     </dependency>
   </dependencies>
 
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <!-- Temporarily override the odlparent checkstyle configuration.
-               We want to enforce some simple rules and add more as we clean up code -->
-          <artifactId>maven-checkstyle-plugin</artifactId>
-          <configuration>
-            <configLocation>checkstyle/java_rules.xml</configLocation>
-            <includeTestSourceDirectory>true</includeTestSourceDirectory>
-            <excludes>org/opendaylight/yang/gen/**,**/config/yang/**</excludes>
-            <failsOnError>true</failsOnError>
-            <consoleOutput>true</consoleOutput>
-          </configuration>
-          <dependencies>
-            <dependency>
-              <groupId>org.opendaylight.lispflowmapping</groupId>
-              <artifactId>common.build.tools</artifactId>
-              <version>${project.version}</version>
-            </dependency>
-          </dependencies>
-          <executions>
-            <execution>
-              <goals>
-                <goal>check</goal>
-              </goals>
-              <phase>process-sources</phase>
-            </execution>
-          </executions>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-
   <!--
       Maven Site Configuration
 
index b3004575b6ca0a7149e512ffd3731abe1d243c4a..23d96b8701be0d45a61f0d24783202f0ddaf5d07 100644 (file)
   </dependencies>
 
   <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <!-- Enforce odlparent checkstyle -->
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <configuration>
+            <includeTestSourceDirectory>true</includeTestSourceDirectory>
+            <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.apache.felix</groupId>
index a37464042600e1943c483757ae0f808df09e543d..77167967ba665d6aa100bd064cb9bfba5e1b1593 100644 (file)
@@ -13,12 +13,12 @@ import org.apache.karaf.shell.console.OsgiCommandSupport;
 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingServiceShell;
 
 /**
- * This class implements the "lisp:addkey" Karaf shell command
+ * This class implements the "lisp:addkey" Karaf shell command.
  *
  * @author Lorand Jakab
  *
  */
-@Command(scope = "mappingservice", name = "addkey", description="Add an authentication key")
+@Command(scope = "mappingservice", name = "addkey", description = "Add an authentication key")
 public class LispAddKey  extends OsgiCommandSupport {
     private IMappingServiceShell mappingServiceShell;
 
index e84bbd350f7b01de0d6ddbe48f6cb78906023532..4e44795cdbbfc1a03e15e8f3fec4210f3ab47015 100644 (file)
@@ -13,16 +13,17 @@ import org.apache.karaf.shell.console.OsgiCommandSupport;
 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingServiceShell;
 
 /**
- * This class implements the "lisp:mappings" Karaf shell command
+ * This class implements the "lisp:mappings" Karaf shell command.
  *
  * @author Lorand Jakab
  *
  */
-@Command(scope = "mappingservice", name = "mappings", description="Print LISP mapping database")
+@Command(scope = "mappingservice", name = "mappings", description = "Print LISP mapping database")
 public class LispMappings  extends OsgiCommandSupport {
     private IMappingServiceShell mappingServiceShell;
 
     @Override
+    @SuppressWarnings("checkstyle:RegexpMultiline")
     protected Object doExecute() throws Exception {
         System.out.print(mappingServiceShell.printMappings());
         return null;
index 048b91c10e32897c75cfacedec28d740cf190ddc..575e4f34e96a7e785447502543d76c3fdbe1b5e5 100644 (file)
     </dependency>
   </dependencies>
 
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <!-- Temporarily override the odlparent checkstyle configuration.
+               We want to enforce some simple rules and add more as we clean up code -->
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <configuration>
+            <configLocation>checkstyle/java_rules.xml</configLocation>
+            <includeTestSourceDirectory>true</includeTestSourceDirectory>
+            <excludes>org/opendaylight/yang/gen/**,**/config/yang/**</excludes>
+            <failsOnError>true</failsOnError>
+            <consoleOutput>true</consoleOutput>
+          </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>org.opendaylight.lispflowmapping</groupId>
+              <artifactId>common.build.tools</artifactId>
+              <version>${project.version}</version>
+            </dependency>
+          </dependencies>
+          <executions>
+            <execution>
+              <goals>
+                <goal>check</goal>
+              </goals>
+              <phase>process-sources</phase>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
   <!--
       Maven Site Configuration