Make new checkstyle violations of rules that
have been cleaned up fail the build.
Change-Id: Ib4109862a4965021e9b63ad938b96dd21929da7d
diff --git a/conf/checkstyle/sun_checks.xml b/conf/checkstyle/sun_checks.xml
index e9bd3ea..8dfe187 100644
--- a/conf/checkstyle/sun_checks.xml
+++ b/conf/checkstyle/sun_checks.xml
@@ -31,6 +31,17 @@
-->
+
+<!--
+ The default severity setting in checkstyle is 'error', so some
+ of the rules below are configured to change the severity to
+ 'warning'. Over time, these 'warning' settings should be
+ removed as more of the ONOS source code is modified to
+ follow the recommended rules.
+-->
+
+
+
<module name="Checker">
<!--
If you set the basedir property below, then all reported file
@@ -42,12 +53,14 @@
<!-- Checks that a package-info.java file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
<!-- ONOS does not currently supply package level Javadoc information
- in package-info files -->
+ in package-info files -->
<!-- <module name="JavadocPackage"/> -->
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
- <module name="NewlineAtEndOfFile"/>
+ <module name="NewlineAtEndOfFile">
+ <property name="severity" value="warning"/>
+ </module>
<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
@@ -55,7 +68,9 @@
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="FileLength"/>
+ <module name="FileLength">
+ <property name="severity" value="warning"/>
+ </module>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
@@ -68,6 +83,7 @@
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
+ <property name="severity" value="warning"/>
</module>
<!-- Checks for Headers -->
@@ -81,14 +97,21 @@
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
- <module name="JavadocMethod"/>
- <module name="JavadocType"/>
+ <module name="JavadocMethod">
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="JavadocType">
+ <property name="severity" value="warning"/>
+ </module>
<module name="JavadocVariable">
<!-- Suppress check for private member Javadocs.
Possibly revist fixing these. -->
<property name="scope" value="public"/>
+ <property name="severity" value="warning"/>
</module>
- <module name="JavadocStyle"/>
+ <module name="JavadocStyle">
+ <property name="severity" value="warning"/>
+ </module>
<!-- Checks for Naming Conventions. -->
@@ -97,16 +120,33 @@
<!-- ONOS allows the name "log" for static final Loggers -->
<property name="format"
value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
+ <property name="severity" value="warning"/>
</module>
<module name="LocalFinalVariableName"/>
- <module name="LocalVariableName"/>
- <module name="MemberName"/>
- <module name="MethodName"/>
- <module name="PackageName"/>
- <module name="ParameterName"/>
- <module name="StaticVariableName"/>
- <module name="TypeName"/>
+ <module name="LocalVariableName">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="MemberName">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="MethodName">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="PackageName"/>
+
+ <module name="ParameterName">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="StaticVariableName">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="TypeName"/>
<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
@@ -123,29 +163,55 @@
<!-- ONOS standard usage is 80 columns, but we allow up
to 120 to not break the build. -->
<property name="max" value="120"/>
+ <property name="severity" value="warning"/>
</module>
- <module name="MethodLength"/>
- <module name="ParameterNumber"/>
+ <module name="MethodLength">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="ParameterNumber">
+ <property name="severity" value="warning"/>
+ </module>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <module name="EmptyForIteratorPad"/>
+ <module name="EmptyForIteratorPad">
+ <property name="severity" value="warning"/>
+ </module>
+
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
- <module name="NoWhitespaceAfter"/>
- <module name="NoWhitespaceBefore"/>
+
+ <module name="NoWhitespaceAfter">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="NoWhitespaceBefore">
+ <property name="severity" value="warning"/>
+ </module>
+
<!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
<!-- <module name="OperatorWrap"/> -->
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
- <module name="WhitespaceAfter"/>
- <module name="WhitespaceAround"/>
+
+ <module name="WhitespaceAfter">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="WhitespaceAround">
+ <property name="severity" value="warning"/>
+ </module>
+
<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
- <module name="ModifierOrder"/>
+ <module name="ModifierOrder">
+ <property name="severity" value="warning"/>
+ </module>
+
<!-- Disabled for ONOS to allow use of public -->
<!-- modifiers in interfaces. -->
<!-- <module name="RedundantModifier"/> -->
@@ -158,43 +224,85 @@
<property name="allowInSwitchCase" value="true"/>
<property name="severity" value="warning"/>
</module>
- <module name="EmptyBlock"/>
- <module name="LeftCurly"/>
- <module name="NeedBraces"/>
- <module name="RightCurly"/>
+ <module name="EmptyBlock">
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="LeftCurly"/>
+
+ <module name="NeedBraces">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="RightCurly"/>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<!-- ONOS allows conditional operators -->
<!-- <module name="AvoidInlineConditionals"/> -->
- <module name="EmptyStatement"/>
+ <module name="EmptyStatement">
+ <property name="severity" value="warning"/>
+ </module>
+
<module name="EqualsHashCode"/>
- <module name="HiddenField"/>
+
+ <module name="HiddenField">
+ <property name="severity" value="warning"/>
+ </module>
+
<module name="IllegalInstantiation"/>
- <module name="InnerAssignment"/>
+
+ <module name="InnerAssignment">
+ <property name="severity" value="warning"/>
+ </module>
+
<!-- Many violations of this rule present, revist in a
subsequent round of cleanups -->
<!-- <module name="MagicNumber"/> -->
- <module name="MissingSwitchDefault"/>
- <module name="RedundantThrows"/>
- <module name="SimplifyBooleanExpression"/>
- <module name="SimplifyBooleanReturn"/>
+ <module name="MissingSwitchDefault">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="RedundantThrows">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="SimplifyBooleanExpression">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="SimplifyBooleanReturn">
+ <property name="severity" value="warning"/>
+ </module>
+
<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<!-- ONOS produces many warnings of this type.
Fixing all of these is outside the scope of the current cleanup. -->
<!-- <module name="DesignForExtension"/> -->
- <module name="FinalClass"/>
- <module name="HideUtilityClassConstructor"/>
+ <module name="FinalClass">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="HideUtilityClassConstructor">
+ <property name="severity" value="warning"/>
+ </module>
+
<module name="InterfaceIsType"/>
- <module name="VisibilityModifier"/>
+
+ <module name="VisibilityModifier">
+ <property name="severity" value="warning"/>
+ </module>
+
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
- <module name="ArrayTypeStyle"/>
+ <module name="ArrayTypeStyle">
+ <property name="severity" value="warning"/>
+ </module>
+
<!-- Many violations of this rule currently, too many to fix
in the current cleanup. -->
<!-- <module name="FinalParameters"/> -->
@@ -202,6 +310,6 @@
<!-- <module name="TodoComment"/> -->
<module name="UpperEll"/>
- </module>
+ </module>
-</module>
+ </module>
diff --git a/pom.xml b/pom.xml
index c6b57dd..0c3286c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,27 +41,27 @@
<build>
<plugins>
<plugin>
- <!-- Note: the checkstyle configuration is also in the reporting section -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle-plugin.version}</version>
- <configuration>
- <configLocation>conf/checkstyle/sun_checks.xml</configLocation>
- <suppressionsLocation>
- ${basedir}/conf/checkstyle/onos_suppressions.xml
- </suppressionsLocation>
- <failsOnError>false</failsOnError>
- </configuration>
- <executions>
- <execution>
- <id>validate-checkstyle</id>
- <phase>compile</phase>
- <goals>
- <!-- Uncomment this goal to make the build fail on Checkstyle errors -->
- <!--<goal>check</goal>-->
- </goals>
- </execution>
- </executions>
+ <!-- Note: the checkstyle configuration is also in the reporting section -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>${checkstyle-plugin.version}</version>
+ <configuration>
+ <configLocation>conf/checkstyle/sun_checks.xml</configLocation>
+ <suppressionsLocation>
+ ${basedir}/conf/checkstyle/onos_suppressions.xml
+ </suppressionsLocation>
+ <failsOnError>false</failsOnError>
+ <logViolationsToConsole>true</logViolationsToConsole>
+ </configuration>
+ <executions>
+ <execution>
+ <id>validate-checkstyle</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -194,12 +194,12 @@
</plugin>
-->
<plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- </configuration>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
</plugin>
<plugin>
<!-- Using groovy script to set maven property ${hostname}.
@@ -271,22 +271,22 @@
<effort>${findbugs.effort}</effort>
<excludeFilterFile>${findbugs.excludeFilterFile}</excludeFilterFile>
</configuration>
- <executions>
- <execution>
- <id>validate-findbugs</id>
- <phase>compile</phase>
- <goals>
- <!-- Uncomment this goal to make the build fail on findbugs errors -->
- <!--<goal>check</goal>-->
- </goals>
- </execution>
- </executions>
+ <executions>
+ <execution>
+ <id>validate-findbugs</id>
+ <phase>compile</phase>
+ <goals>
+ <!-- Uncomment this goal to make the build fail on findbugs errors -->
+ <!--<goal>check</goal>-->
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.1</version>
- <configuration>
+ <configuration>
<!--
Note: Exclusion definition exists in multiple places.
- In file ${findbugs.excludeFilterFile} defined at top of pom.xml
@@ -294,26 +294,26 @@
- maven-pmd-plugin configuration in pom.xml
(under build and reporting)
-->
- <excludes>
+ <excludes>
<exclude>**/datastore/serializers/**</exclude>
- <exclude>**/edu/stanford/**</exclude>
- <exclude>**/net/floodlightcontroller/**</exclude>
- <exclude>**/org/openflow/**</exclude>
- </excludes>
- <rulesets>
- <ruleset>${basedir}/conf/pmd/onos_ruleset.xml</ruleset>
- </rulesets>
- </configuration>
- <executions>
- <execution>
- <id>validate-pmd</id>
- <phase>compile</phase>
- <goals>
- <!-- Uncomment this goal to make the build fail on pmd errors -->
- <!--<goal>check</goal>-->
- </goals>
- </execution>
- </executions>
+ <exclude>**/edu/stanford/**</exclude>
+ <exclude>**/net/floodlightcontroller/**</exclude>
+ <exclude>**/org/openflow/**</exclude>
+ </excludes>
+ <rulesets>
+ <ruleset>${basedir}/conf/pmd/onos_ruleset.xml</ruleset>
+ </rulesets>
+ </configuration>
+ <executions>
+ <execution>
+ <id>validate-pmd</id>
+ <phase>compile</phase>
+ <goals>
+ <!-- Uncomment this goal to make the build fail on pmd errors -->
+ <!--<goal>check</goal>-->
+ </goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
<pluginManagement>
@@ -404,12 +404,12 @@
</configuration>
</plugin>
<plugin>
- <!-- Note: the checkstyle configuration is also in the build section -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle-plugin.version}</version>
- <configuration>
- <configLocation>conf/checkstyle/sun_checks.xml</configLocation>
+ <!-- Note: the checkstyle configuration is also in the build section -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>${checkstyle-plugin.version}</version>
+ <configuration>
+ <configLocation>conf/checkstyle/sun_checks.xml</configLocation>
<!--
Note: Exclusion definition exists in multiple places.
- In file ${findbugs.excludeFilterFile} defined at top of pom.xml
@@ -418,17 +418,17 @@
(under build and reporting)
-->
<excludes>**/datastore/serializers/**</excludes>
- <suppressionsLocation>
+ <suppressionsLocation>
${basedir}/conf/checkstyle/onos_suppressions.xml
</suppressionsLocation>
- </configuration>
- <reportSets>
- <reportSet>
- <reports>
- <report>checkstyle</report>
- </reports>
- </reportSet>
- </reportSets>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>checkstyle</report>
+ </reports>
+ </reportSet>
+ </reportSets>
</plugin>
<!-- Note: the findbugs configuration is also in the build section -->
<plugin>
@@ -460,19 +460,19 @@
-->
<excludes>
<exclude>**/datastore/serializers/**</exclude>
- <exclude>**/edu/stanford/**</exclude>
- <exclude>**/net/floodlightcontroller/**</exclude>
- <exclude>**/org/openflow/**</exclude>
+ <exclude>**/edu/stanford/**</exclude>
+ <exclude>**/net/floodlightcontroller/**</exclude>
+ <exclude>**/org/openflow/**</exclude>
</excludes>
- <rulesets>
- <ruleset>${basedir}/conf/pmd/onos_ruleset.xml</ruleset>
- </rulesets>
+ <rulesets>
+ <ruleset>${basedir}/conf/pmd/onos_ruleset.xml</ruleset>
+ </rulesets>
</configuration>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId>
- <version>2.4</version>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ <version>2.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>