From 3322a0f7105a6e37c5d92fe2cd147381b2855b52 Mon Sep 17 00:00:00 2001 From: Lorand Jakab Date: Wed, 22 Oct 2014 12:07:11 +0300 Subject: [PATCH] Add coding style checks Run the maven-checkstyle-plugin during the build, using rules from the controller project, which include: - No TAB characters - No trailing spaces - No redundant, unused or star imports - Long constants defined with upper ell: 'L' - No empty statements (standalone ';' semicolon) - If a class overrides equals() it must override hashCode() These rules are applied to .java, .xml, and .yang files. Rule violations are reported on the console, but they don't cause the build to fail. This behavior should be changed in the future, when the existing code base is cleaned up, so that no new violations are introduced after that. Change-Id: I552eb72e1ac4b96a4cf80a216a1638bb36d77821 Signed-off-by: Lorand Jakab --- commons/parent/pom.xml | 33 +++++++++++++++++++++++++++++++++ pom.xml | 20 ++++++++++++-------- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/commons/parent/pom.xml b/commons/parent/pom.xml index e8ff45050..eeab58c88 100644 --- a/commons/parent/pom.xml +++ b/commons/parent/pom.xml @@ -33,6 +33,7 @@ 1.0.0 0.6.0-SNAPSHOT 0.3.0-SNAPSHOT + 0.1.0-SNAPSHOT 1.3.1 1.26.2 0.7.0-SNAPSHOT @@ -712,6 +713,38 @@ + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${checkstyle.version} + + false + controller/checkstyle.xml + true + true + ${project.basedir} + **\/*.java,**\/*.xml,**\/*.yang + **\/target\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/ + + + + org.opendaylight.controller + checkstyle + ${controller.checkstyle.version} + + + + + + check + + process-sources + + + diff --git a/pom.xml b/pom.xml index f3d09991e..b5e484d5e 100644 --- a/pom.xml +++ b/pom.xml @@ -26,8 +26,7 @@ - + org.apache.maven.plugins maven-dependency-plugin 2.8 @@ -37,20 +36,25 @@ + add the invocation of this plugin to the root parent. Configuration is in + the ODL parent. --> com.google.code.sortpom maven-sortpom-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + + qualified URLs to the nexus because it has to download the parent. There + seems to be a bug where you need to parent before any properties can be substituted + in. You can override this URL by using the "mirror" section of your settings.xml + configuration file. See http://maven.apache.org/guides/mini/guide-mirror-settings.html --> -- 2.36.6