Add DataBroker exclusion checks 64/74464/1
authorStephen Kitt <skitt@redhat.com>
Wed, 25 Jul 2018 15:10:12 +0000 (17:10 +0200)
committerStephen Kitt <skitt@redhat.com>
Wed, 25 Jul 2018 15:10:12 +0000 (17:10 +0200)
This ports the DataBroker exclusion checks (using Checkstyle) from
NetVirt, and enforces them for interfacemanager.

Change-Id: I4ff045b9063f529b793e29814bf51086e5749ce8
JIRA: GENIUS-177
Signed-off-by: Stephen Kitt <skitt@redhat.com>
commons/checkstyle/pom.xml [new file with mode: 0644]
commons/checkstyle/src/main/resources/databroker-checks.xml [new file with mode: 0644]
commons/pom.xml
interfacemanager/interfacemanager-impl/pom.xml

diff --git a/commons/checkstyle/pom.xml b/commons/checkstyle/pom.xml
new file mode 100644 (file)
index 0000000..cbc7fe7
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2018 Red Hat, Inc. and others.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
+-->
+<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/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.opendaylight.odlparent</groupId>
+        <artifactId>odlparent</artifactId>
+        <version>3.1.2</version>
+        <relativePath/>
+    </parent>
+
+    <groupId>org.opendaylight.genius</groupId>
+    <artifactId>checkstyle</artifactId>
+    <version>0.5.0-SNAPSHOT</version>
+    <name>ODL :: genius :: ${project.artifactId}</name>
+</project>
diff --git a/commons/checkstyle/src/main/resources/databroker-checks.xml b/commons/checkstyle/src/main/resources/databroker-checks.xml
new file mode 100644 (file)
index 0000000..cc58e59
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+Copyright © 2018 Red Hat, Inc. and others.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
+-->
+<!DOCTYPE module PUBLIC
+        "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+        "http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
+<module name="Checker">
+    <module name="SuppressWarningsFilter" />
+
+    <module name="TreeWalker">
+        <module name="SuppressWarningsHolder" />
+
+        <module name="com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck">
+            <property name="methodName" value="newWriteOnlyTransaction" />
+        </module>
+        <module name="com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck">
+            <property name="methodName" value="newReadWriteTransaction" />
+        </module>
+    </module>
+</module>
\ No newline at end of file
index 1ce5e8407d689b89c99b4cb26c137f1436b355db..8172fe9af97c1e11871b3312ca241c130e23e4b2 100644 (file)
@@ -28,6 +28,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
     <module>quality-parent</module>
     <module>binding-parent</module>
     <module>testutils</module>
+    <module>checkstyle</module>
   </modules>
 
   <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
index 6bf8fbc95f329422658b749db8c200067f56f99a..35bb8be4ea09afc3339ec817f3910a0d6023c0b6 100644 (file)
@@ -184,6 +184,38 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   </dependencies>
 
   <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <dependencies>
+            <dependency>
+              <groupId>org.opendaylight.genius</groupId>
+              <artifactId>checkstyle</artifactId>
+              <version>0.5.0-SNAPSHOT</version>
+            </dependency>
+          </dependencies>
+          <executions>
+            <execution>
+              <id>check-databroker</id>
+              <goals>
+                <goal>check</goal>
+              </goals>
+              <phase>process-sources</phase>
+              <configuration>
+                <configLocation>databroker-checks.xml</configLocation>
+                <includeResources>false</includeResources>
+                <includeTestSourceDirectory>false</includeTestSourceDirectory>
+                <includeTestResources>false</includeTestResources>
+                <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+                <failsOnError>true</failsOnError>
+                <consoleOutput>true</consoleOutput>
+              </configuration>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.eclipse.xtend</groupId>