You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2017/08/07 13:17:18 UTC

[03/11] flink git commit: [FLINK-4499] [build] Add spotbugs plugin

[FLINK-4499] [build] Add spotbugs plugin

This closes #4367.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/a1644076
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/a1644076
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/a1644076

Branch: refs/heads/master
Commit: a1644076ee0b1771777ffc9e5634e5b2ece89d00
Parents: 27429a7
Author: zentol <ch...@apache.org>
Authored: Mon Jul 17 16:59:22 2017 +0200
Committer: zentol <ch...@apache.org>
Committed: Mon Aug 7 15:16:56 2017 +0200

----------------------------------------------------------------------
 pom.xml                          |  75 ++++++
 tools/maven/spotbugs-exclude.xml | 447 ++++++++++++++++++++++++++++++++++
 tools/travis_mvn_watchdog.sh     |   1 +
 3 files changed, 523 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/a1644076/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 427e813..e57d555 100644
--- a/pom.xml
+++ b/pom.xml
@@ -525,6 +525,81 @@ under the License.
 		</profile>
 
 		<profile>
+			<id>spotbugs</id>
+			<activation>
+				<property>
+					<name>spotbugs</name>
+				</property>
+			</activation>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>com.github.hazendaz.spotbugs</groupId>
+						<artifactId>spotbugs-maven-plugin</artifactId>
+						<version>3.0.6</version>
+
+						<executions>
+							<execution>
+								<id>findbugs-run</id>
+								<phase>compile</phase>
+								<goals>
+									<goal>check</goal>
+								</goals>
+							</execution>
+						</executions>
+
+						<configuration>
+							<xmlOutput>true</xmlOutput>
+							<threshold>Low</threshold>
+							<effort>default</effort>
+							<findbugsXmlOutputDirectory>${project.build.directory}/spotbugs</findbugsXmlOutputDirectory>
+							<excludeFilterFile>tools/maven/spotbugs-exclude.xml</excludeFilterFile>
+							<failOnError>true</failOnError>
+						</configuration>
+					</plugin>
+
+					<plugin>
+						<groupId>org.codehaus.mojo</groupId>
+						<artifactId>xml-maven-plugin</artifactId>
+						<version>1.0.1</version>
+						<executions>
+							<execution>
+								<phase>verify</phase>
+								<goals>
+									<goal>transform</goal>
+								</goals>
+							</execution>
+						</executions>
+						<configuration>
+							<transformationSets>
+								<transformationSet>
+									<dir>${project.build.directory}/spotbugs</dir>
+									<outputDir>${project.build.directory}/spotbugs</outputDir>
+									<!-- A list of available stylesheets can be found here: https://github.com/findbugsproject/findbugs/tree/master/findbugs/src/xsl -->
+									<stylesheet>plain.xsl</stylesheet>
+									
+									<fileMappers>
+										<fileMapper
+											implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
+											<targetExtension>.html</targetExtension>
+										</fileMapper>
+									</fileMappers>
+								</transformationSet>
+							</transformationSets>
+						</configuration>
+						<dependencies>
+							<dependency>
+								<groupId>com.github.hazendaz.spotbugs</groupId>
+								<artifactId>spotbugs-maven-plugin</artifactId>
+								<version>3.0.6</version>
+							</dependency>
+						</dependencies>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+
+		<profile>
 			<id>vendor-repos</id>
 			<!-- Add vendor maven repositories -->
 			<repositories>

http://git-wip-us.apache.org/repos/asf/flink/blob/a1644076/tools/maven/spotbugs-exclude.xml
----------------------------------------------------------------------
diff --git a/tools/maven/spotbugs-exclude.xml b/tools/maven/spotbugs-exclude.xml
new file mode 100644
index 0000000..c9e63cd
--- /dev/null
+++ b/tools/maven/spotbugs-exclude.xml
@@ -0,0 +1,447 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<FindBugsFilter>
+	<Match>
+		<Bug pattern="VA_FORMAT_STRING_USES_NEWLINE"/>
+	</Match>
+	<Match>
+		<Bug pattern="BC_BAD_CAST_TO_ABSTRACT_COLLECTION"/>
+	</Match>
+	<Match>
+		<Bug pattern="BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS"/>
+	</Match>
+	<Match>
+		<Bug pattern="BC_IMPOSSIBLE_INSTANCEOF"/>
+	</Match>
+	<Match>
+		<Bug pattern="BC_UNCONFIRMED_CAST"/>
+	</Match>
+	<Match>
+		<Bug pattern="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE"/>
+	</Match>
+	<Match>
+		<Bug pattern="BC_VACUOUS_INSTANCEOF"/>
+	</Match>
+	<Match>
+		<Bug pattern="BX_BOXING_IMMEDIATELY_UNBOXED"/>
+	</Match>
+	<Match>
+		<Bug pattern="BX_BOXING_IMMEDIATELY_UNBOXED_TO_PERFORM_COERCION"/>
+	</Match>
+	<Match>
+		<Bug pattern="BX_UNBOXING_IMMEDIATELY_REBOXED"/>
+	</Match>
+	<Match>
+		<Bug pattern="BIT_ADD_OF_SIGNED_BYTE"/>
+	</Match>
+	<Match>
+		<Bug pattern="BIT_SIGNED_CHECK"/>
+	</Match>
+	<Match>
+		<Bug pattern="CI_CONFUSED_INHERITANCE"/>
+	</Match>
+	<Match>
+		<Bug pattern="CN_IDIOM"/>
+	</Match>
+	<Match>
+		<Bug pattern="CN_IDIOM_NO_SUPER_CALL"/>
+	</Match>
+	<Match>
+		<Bug pattern="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE"/>
+	</Match>
+	<Match>
+		<Bug pattern="CO_COMPARETO_INCORRECT_FLOATING"/>
+	</Match>
+	<Match>
+		<Bug pattern="DB_DUPLICATE_BRANCHES"/>
+	</Match>
+	<Match>
+		<Bug pattern="DB_DUPLICATE_SWITCH_CLAUSES"/>
+	</Match>
+	<Match>
+		<Bug pattern="DC_PARTIALLY_CONSTRUCTED"/>
+	</Match>
+	<Match>
+		<Bug pattern="DE_MIGHT_IGNORE"/>
+	</Match>
+	<Match>
+		<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
+	</Match>
+	<Match>
+		<Bug pattern="DM_BOXED_PRIMITIVE_FOR_PARSING"/>
+	</Match>
+	<Match>
+		<Bug pattern="DM_BOXED_PRIMITIVE_TOSTRING"/>
+	</Match>
+	<Match>
+		<Bug pattern="DM_CONVERT_CASE"/>
+	</Match>
+	<Match>
+		<Bug pattern="DM_DEFAULT_ENCODING"/>
+	</Match>
+	<Match>
+		<Bug pattern="DM_EXIT"/>
+	</Match>
+	<Match>
+		<Bug pattern="DM_FP_NUMBER_CTOR"/>
+	</Match>
+	<Match>
+		<Bug pattern="DM_GC"/>
+	</Match>
+	<Match>
+		<Bug pattern="DM_NEW_FOR_GETCLASS"/>
+	</Match>
+	<Match>
+		<Bug pattern="DM_NEXTINT_VIA_NEXTDOUBLE"/>
+	</Match>
+	<Match>
+		<Bug pattern="DM_NUMBER_CTOR"/>
+	</Match>
+	<Match>
+		<Bug pattern="DM_STRING_TOSTRING"/>
+	</Match>
+	<Match>
+		<Bug pattern="DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS"/>
+	</Match>
+	<Match>
+		<Bug pattern="DMI_RANDOM_USED_ONLY_ONCE"/>
+	</Match>
+	<Match>
+		<Bug pattern="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED"/>
+	</Match>
+	<Match>
+		<Bug pattern="DP_DO_INSIDE_DO_PRIVILEGED"/>
+	</Match>
+	<Match>
+		<Bug pattern="EI_EXPOSE_REP"/>D
+	</Match>
+	<Match>
+		<Bug pattern="EI_EXPOSE_REP2"/>
+	</Match>
+	<Match>
+		<Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
+	</Match>
+	<Match>
+		<Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+	</Match>
+	<Match>
+		<Bug pattern="EQ_GETCLASS_AND_CLASS_CONSTANT"/>
+	</Match>
+	<Match>
+		<Bug pattern="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC"/>
+	</Match>
+	<Match>
+		<Bug pattern="EQ_UNUSUAL"/>
+	</Match>
+	<Match>
+		<Bug pattern="FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER"/>
+	</Match>
+	<Match>
+		<Bug pattern="FE_FLOATING_POINT_EQUALITY"/>
+	</Match>
+	<Match>
+		<Bug pattern="HE_EQUALS_NO_HASHCODE"/>
+	</Match>
+	<Match>
+		<Bug pattern="HE_EQUALS_USE_HASHCODE"/>
+	</Match>
+	<Match>
+		<Bug pattern="HE_HASHCODE_NO_EQUALS"/>
+	</Match>
+	<Match>
+		<Bug pattern="HE_HASHCODE_USE_OBJECT_EQUALS"/>
+	</Match>
+	<Match>
+		<Bug pattern="ICAST_IDIV_CAST_TO_DOUBLE"/>
+	</Match>
+	<Match>
+		<Bug pattern="ICAST_INTEGER_MULTIPLY_CAST_TO_LONG"/>
+	</Match>
+	<Match>
+		<Bug pattern="ICAST_QUESTIONABLE_UNSIGNED_RIGHT_SHIFT"/>
+	</Match>
+	<Match>
+		<Bug pattern="INT_BAD_COMPARISON_WITH_NONNEGATIVE_VALUE"/>
+	</Match>
+	<Match>
+		<Bug pattern="IP_PARAMETER_IS_DEAD_BUT_OVERWRITTEN"/>
+	</Match>
+	<Match>
+		<Bug pattern="IS2_INCONSISTENT_SYNC"/>
+	</Match>
+	<Match>
+		<Bug pattern="IT_NO_SUCH_ELEMENT"/>
+	</Match>
+	<Match>
+		<Bug pattern="JLM_JSR166_UTILCONCURRENT_MONITORENTER"/>
+	</Match>
+	<Match>
+		<Bug pattern="LI_LAZY_INIT_STATIC"/>
+	</Match>
+	<Match>
+		<Bug pattern="MS_MUTABLE_ARRAY"/>
+	</Match>
+	<Match>
+		<Bug pattern="MS_MUTABLE_COLLECTION_PKGPROTECT"/>
+	</Match>
+	<Match>
+		<Bug pattern="MS_PKGPROTECT"/>
+	</Match>
+	<Match>
+		<Bug pattern="MS_SHOULD_BE_FINAL"/>
+	</Match>
+	<Match>
+		<Bug pattern="NM_CLASS_NAMING_CONVENTION"/>
+	</Match>
+	<Match>
+		<Bug pattern="NM_CLASS_NOT_EXCEPTION"/>
+	</Match>
+	<Match>
+		<Bug pattern="NM_CONFUSING"/>
+	</Match>
+	<Match>
+		<Bug pattern="NM_FIELD_NAMING_CONVENTION"/>
+	</Match>
+	<Match>
+		<Bug pattern="NM_FUTURE_KEYWORD_USED_AS_IDENTIFIER"/>
+	</Match>
+	<Match>
+		<Bug pattern="NM_FUTURE_KEYWORD_USED_AS_MEMBER_IDENTIFIER"/>
+	</Match>
+	<Match>
+		<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS"/>
+	</Match>
+	<Match>
+		<Bug pattern="NO_NOTIFY_NOT_NOTIFYALL"/>
+	</Match>
+	<Match>
+		<Bug pattern="NP_ALWAYS_NULL"/>
+	</Match>
+	<Match>
+		<Bug pattern="NP_DEREFERENCE_OF_READLINE_VALUE"/>
+	</Match>
+	<Match>
+		<Bug pattern="NP_EQUALS_SHOULD_HANDLE_NULL_ARGUMENT"/>
+	</Match>
+	<Match>
+		<Bug pattern="NP_LOAD_OF_KNOWN_NULL_VALUE"/>
+	</Match>
+	<Match>
+		<Bug pattern="NM_METHOD_NAMING_CONVENTION"/>
+	</Match>
+	<Match>
+		<Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE"/>
+	</Match>
+	<Match>
+		<Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
+	</Match>
+	<Match>
+		<Bug pattern="NP_NULL_ON_SOME_PATH"/>
+	</Match>
+	<Match>
+		<Bug pattern="NP_NULL_ON_SOME_PATH_EXCEPTION"/>
+	</Match>
+	<Match>
+		<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
+	</Match>
+	<Match>
+		<Bug pattern="NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE"/>
+	</Match>
+	<Match>
+		<Bug pattern="NP_NULL_PARAM_DEREF"/>
+	</Match>
+	<Match>
+		<Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/>
+	</Match>
+	<Match>
+		<Bug pattern="NS_DANGEROUS_NON_SHORT_CIRCUIT"/>
+	</Match>
+	<Match>
+		<Bug pattern="NS_NON_SHORT_CIRCUIT"/>
+	</Match>
+	<Match>
+		<Bug pattern="OBL_UNSATISFIED_OBLIGATION"/>
+	</Match>
+	<Match>
+		<Bug pattern="OS_OPEN_STREAM"/>
+	</Match>
+	<Match>
+		<Bug pattern="OS_OPEN_STREAM_EXCEPTION_PATH"/>
+	</Match>
+	<Match>
+		<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+	</Match>
+	<Match>
+		<Bug pattern="REC_CATCH_EXCEPTION"/>
+	</Match>
+	<Match>
+		<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
+	</Match>
+	<Match>
+		<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE"/>
+	</Match>
+	<Match>
+		<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
+	</Match>
+	<Match>
+		<Bug pattern="RI_REDUNDANT_INTERFACES"/>
+	</Match>
+	<Match>
+		<Bug pattern="RpC_REPEATED_CONDITIONAL_TEST"/>
+	</Match>
+	<Match>
+		<Bug pattern="RR_NOT_CHECKED"/>
+	</Match>
+	<Match>
+		<Bug pattern="RV_EXCEPTION_NOT_THROWN"/>
+	</Match>
+	<Match>
+		<Bug pattern="RV_NEGATING_RESULT_OF_COMPARETO"/>
+	</Match>
+	<Match>
+		<Bug pattern="RV_RETURN_VALUE_IGNORED"/>
+	</Match>
+	<Match>
+		<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
+	</Match>
+	<Match>
+		<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
+	</Match>
+	<Match>
+		<Bug pattern="SA_LOCAL_SELF_ASSIGNMENT"/>
+	</Match>
+	<Match>
+		<Bug pattern="SBSC_USE_STRINGBUFFER_CONCATENATION"/>
+	</Match>
+	<Match>
+		<Bug pattern="SC_START_IN_CTOR"/>
+	</Match>
+	<Match>
+		<Bug pattern="SE_BAD_FIELD"/>
+	</Match>
+	<Match>
+		<Bug pattern="SE_BAD_FIELD_INNER_CLASS"/>
+	</Match>
+	<Match>
+		<Bug pattern="SE_BAD_FIELD_STORE"/>
+	</Match>
+	<Match>
+		<Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
+	</Match>
+	<Match>
+		<Bug pattern="SE_INNER_CLASS"/>
+	</Match>
+	<Match>
+		<Bug pattern="SE_NO_SERIALVERSIONID"/>
+	</Match>
+	<Match>
+		<Bug pattern="SE_NO_SUITABLE_CONSTRUCTOR"/>
+	</Match>
+	<Match>
+		<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
+	</Match>
+	<Match>
+		<Bug pattern="SF_SWITCH_NO_DEFAULT"/>
+	</Match>
+	<Match>
+		<Bug pattern="SIC_INNER_SHOULD_BE_STATIC"/>
+	</Match>
+	<Match>
+		<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/>
+	</Match>
+	<Match>
+		<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS"/>
+	</Match>
+	<Match>
+		<Bug pattern="SIO_SUPERFLUOUS_INSTANCEOF"/>
+	</Match>
+	<Match>
+		<Bug pattern="SF_SWITCH_FALLTHROUGH"/>
+	</Match>
+	<Match>
+		<Bug pattern="SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE"/>
+	</Match>
+	<Match>
+		<Bug pattern="SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING"/>
+	</Match>
+	<Match>
+		<Bug pattern="SR_NOT_CHECKED"/>
+	</Match>
+	<Match>
+		<Bug pattern="SS_SHOULD_BE_STATIC"/>
+	</Match>
+	<Match>
+		<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
+	</Match>
+	<Match>
+		<Bug pattern="UC_USELESS_CONDITION"/>
+	</Match>
+	<Match>
+		<Bug pattern="UC_USELESS_OBJECT"/>
+	</Match>
+	<Match>
+		<Bug pattern="UCF_USELESS_CONTROL_FLOW"/>
+	</Match>
+	<Match>
+		<Bug pattern="UL_UNRELEASED_LOCK"/>
+	</Match>
+	<Match>
+		<Bug pattern="UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS"/>
+	</Match>
+	<Match>
+		<Bug pattern="UPM_UNCALLED_PRIVATE_METHOD"/>
+	</Match>
+	<Match>
+		<Bug pattern="URF_UNREAD_FIELD"/>
+	</Match>
+	<Match>
+		<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>
+	</Match>
+	<Match>
+		<Bug pattern="UUF_UNUSED_FIELD"/>
+	</Match>
+	<Match>
+		<Bug pattern="UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD"/>
+	</Match>
+	<Match>
+		<Bug pattern="UW_UNCOND_WAIT"/>
+	</Match>
+	<Match>
+		<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
+	</Match>
+	<Match>
+		<Bug pattern="UWF_UNWRITTEN_FIELD"/>
+	</Match>
+	<Match>
+		<Bug pattern="UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD"/>
+	</Match>
+	<Match>
+		<Bug pattern="VO_VOLATILE_INCREMENT"/>
+	</Match>
+	<Match>
+		<Bug pattern="VO_VOLATILE_REFERENCE_TO_ARRAY"/>
+	</Match>
+	<Match>
+		<Bug pattern="WA_NOT_IN_LOOP"/>
+	</Match>
+	<Match>
+		<Bug pattern="WMI_WRONG_MAP_ITERATOR"/>
+	</Match>
+</FindBugsFilter>

http://git-wip-us.apache.org/repos/asf/flink/blob/a1644076/tools/travis_mvn_watchdog.sh
----------------------------------------------------------------------
diff --git a/tools/travis_mvn_watchdog.sh b/tools/travis_mvn_watchdog.sh
index b837fbd..a3790ea 100755
--- a/tools/travis_mvn_watchdog.sh
+++ b/tools/travis_mvn_watchdog.sh
@@ -133,6 +133,7 @@ case $TEST in
 		# compile everything since dist needs it anyway
 		MVN_COMPILE_MODULES=""
 		MVN_TEST_MODULES="-pl $NEGATED_CORE,$NEGATED_LIBRARIES,$NEGATED_CONNECTORS,$NEGATED_TESTS"
+		MVN_COMPILE_OPTIONS="-Dspotbugs"
 	;;
 esac