You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by do...@apache.org on 2022/08/20 01:14:05 UTC

[orc] branch main updated: ORC-1254: Add spotbugs check

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new e2ff2d44c ORC-1254: Add spotbugs check
e2ff2d44c is described below

commit e2ff2d44c88fff03f2b51f15103794dc925c3987
Author: William Hyun <wi...@apache.org>
AuthorDate: Fri Aug 19 18:13:55 2022 -0700

    ORC-1254: Add spotbugs check
    
    ### What changes were proposed in this pull request?
    This PR aims to add spotbugs check.
    
    ### Why are the changes needed?
    This will improve test coverage on Java 8+.
    - https://github.com/spotbugs/spotbugs
    
    `findbug` does not support Java 9+.
    
    ### How was this patch tested?
    Pass the CIs.
    
    Closes #1225 from williamhyun/spotbug.
    
    Authored-by: William Hyun <wi...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 java/pom.xml              | 29 ++++++++++++++++++
 java/spotbugs-exclude.xml | 77 +++++++++++++++++++++++++++++++++++++++++++++++
 java/spotbugs-include.xml | 25 +++++++++++++++
 3 files changed, 131 insertions(+)

diff --git a/java/pom.xml b/java/pom.xml
index 057f87560..f9ae23ae6 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -303,6 +303,31 @@
             </execution>
           </executions>
         </plugin>
+        <plugin>
+          <groupId>com.github.spotbugs</groupId>
+          <artifactId>spotbugs-maven-plugin</artifactId>
+          <version>4.7.1.1</version>
+          <dependencies>
+            <dependency>
+              <groupId>com.github.spotbugs</groupId>
+              <artifactId>spotbugs</artifactId>
+              <version>4.7.1</version>
+            </dependency>
+          </dependencies>
+          <configuration>
+            <includeFilterFile>spotbugs-include.xml</includeFilterFile>
+            <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
+          </configuration>
+          <executions>
+            <execution>
+              <id>analyze-compile</id>
+              <phase>test</phase>
+              <goals>
+                <goal>check</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
         <plugin>
           <groupId>org.apache.rat</groupId>
           <artifactId>apache-rat-plugin</artifactId>
@@ -493,6 +518,10 @@
             <groupId>org.codehaus.mojo</groupId>
             <artifactId>findbugs-maven-plugin</artifactId>
           </plugin>
+          <plugin>
+            <groupId>com.github.spotbugs</groupId>
+            <artifactId>spotbugs-maven-plugin</artifactId>
+          </plugin>
           <plugin>
             <groupId>org.apache.rat</groupId>
             <artifactId>apache-rat-plugin</artifactId>
diff --git a/java/spotbugs-exclude.xml b/java/spotbugs-exclude.xml
new file mode 100644
index 000000000..d5f7fe7d9
--- /dev/null
+++ b/java/spotbugs-exclude.xml
@@ -0,0 +1,77 @@
+<?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>
+    <Or>
+      <Class name="~org.apache.orc.OrcProto.*" />
+      <Class name="~org.apache.orc.bench.*" />
+    </Or>
+  </Match>
+
+  <Match>
+    <And>
+      <Bug pattern="SA_LOCAL_SELF_COMPARISON" />
+      <Class name="org.apache.orc.impl.ConvertTreeReaderFactory$ConvertTreeReader" />
+    </And>
+  </Match>
+  <Match>
+    <And>
+      <Bug pattern="CN_IDIOM_NO_SUPER_CALL" />
+      <Class name="org.apache.orc.TypeDescription" />
+    </And>
+  </Match>
+  <Match>
+    <And>
+      <Bug pattern="EQ_UNUSUAL" />
+      <Class name="org.apache.orc.TypeDescription" />
+    </And>
+  </Match>
+  <Match>
+    <And>
+      <Bug pattern="SF_SWITCH_FALLTHROUGH" />
+      <Class name="org.apache.orc.util.Murmur3" />
+    </And>
+  </Match>
+  <Match>
+    <And>
+      <Bug pattern="SF_SWITCH_NO_DEFAULT" />
+      <Class name="org.apache.orc.util.Murmur3" />
+    </And>
+  </Match>
+  <Match>
+    <And>
+      <Bug pattern="DM_EXIT" />
+      <Class name="org.apache.orc.tools.KeyTool" />
+    </And>
+  </Match>
+  <Match>
+    <And>
+      <Bug pattern="DM_EXIT" />
+      <Class name="org.apache.orc.tools.json.JsonSchemaFinder" />
+    </And>
+  </Match>
+  <Match>
+    <And>
+      <Bug pattern="REC_CATCH_EXCEPTION" />
+      <Class name="org.apache.orc.tools.ScanData" />
+    </And>
+  </Match>
+</FindBugsFilter>
diff --git a/java/spotbugs-include.xml b/java/spotbugs-include.xml
new file mode 100644
index 000000000..8de6658f6
--- /dev/null
+++ b/java/spotbugs-include.xml
@@ -0,0 +1,25 @@
+<?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 category="SECURITY,CORRECTNESS,MT_CORRECTNESS,BAD_PRACTICE,PERFORMANCE,STYLE"/>
+  </Match>
+</FindBugsFilter>