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

abhi pushed a commit to branch ranger-5019
in repository https://gitbox.apache.org/repos/asf/ranger.git

commit 3147b848268a819ae7c42f092aadfdcfb8bd933b
Author: Abhishek Kumar <[email protected]>
AuthorDate: Thu Dec 5 14:40:08 2024 -0800

    RANGER-5019: Fix spotbug checks for sub-modules
---
 agents-common/dev-support/spotbugsIncludeFile.xml | 64 -----------------------
 pom.xml                                           | 10 ++--
 2 files changed, 7 insertions(+), 67 deletions(-)

diff --git a/agents-common/dev-support/spotbugsIncludeFile.xml 
b/agents-common/dev-support/spotbugsIncludeFile.xml
deleted file mode 100644
index 9a0a9261a..000000000
--- a/agents-common/dev-support/spotbugsIncludeFile.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<!--
-   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>
-  <!--
-        For now, lets find only critical bugs from static code analyzer
-  -->
-  <Match>
-    <Priority value="1"/>
-    <Not>
-      <Or>
-        <Bug pattern="DM_DEFAULT_ENCODING" />
-        <Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" />
-        <Bug pattern="MS_SHOULD_BE_FINAL" />
-        <Bug pattern="RU_INVOKE_RUN" />
-        <Bug pattern="DM_BOXED_PRIMITIVE_FOR_PARSING" />
-        <Bug pattern="NP_BOOLEAN_RETURN_NULL" />
-        <Bug pattern="SE_BAD_FIELD" />
-        <Bug pattern="NP_NULL_ON_SOME_PATH" />
-        <Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE" />
-        <Bug pattern="HE_EQUALS_USE_HASHCODE" />
-        <Bug pattern="RC_REF_COMPARISON" />
-        <Bug pattern="MS_SHOULD_BE_REFACTORED_TO_BE_FINAL" />
-        <Bug pattern="RV_EXCEPTION_NOT_THROWN" />
-        <Bug pattern="DMI_INVOKING_TOSTRING_ON_ARRAY" />
-        <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT" />
-        <Bug pattern="UC_USELESS_CONDITION" />
-        <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" />
-        <Bug pattern="MS_MUTABLE_COLLECTION" />
-        <Bug pattern="DM_BOXED_PRIMITIVE_TOSTRING" />
-        <Bug pattern="NP_NULL_PARAM_DEREF" />
-        <Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS" />
-        <Bug pattern="IL_INFINITE_RECURSIVE_LOOP" />
-        <Bug pattern="DMI_RANDOM_USED_ONLY_ONCE" />
-        <Bug pattern="UI_INHERITANCE_UNSAFE_GETRESOURCE" />
-      </Or>
-    </Not>
-  </Match>
-  <!-- TODO: enable each priority one by one
-  <Match>
-      <Priority value="2"/>
-  </Match>
-  <Match>
-      <Priority value="3"/>
-  </Match>
-  <Match>
-      <Priority value="4"/>
-  </Match>
-  -->
-
-</FindBugsFilter>
diff --git a/pom.xml b/pom.xml
index 04f5ea76a..2d4ad29f6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,6 +46,7 @@
         <aws-java-sdk.version>1.12.765</aws-java-sdk.version>
         <bouncycastle.version>1.70</bouncycastle.version>
         <cglib.version>2.2.0-b23</cglib.version>
+        <spotbug.failOnViolation>false</spotbug.failOnViolation>
         <checkstyle.failOnViolation>false</checkstyle.failOnViolation>
         <checkstyle.plugin.version>3.1.0</checkstyle.plugin.version>
         <checkstyle.version>8.29</checkstyle.version>
@@ -660,14 +661,17 @@
                 <groupId>com.github.spotbugs</groupId>
                 <artifactId>spotbugs-maven-plugin</artifactId>
                 <version>${spotbugs.plugin.version}</version>
-                <configuration>
-                    
<includeFilterFile>./dev-support/spotbugsIncludeFile.xml</includeFilterFile>
-                </configuration>
                 <executions>
                     <execution>
+                        <id>spotbugs-check</id>
                         <goals>
                             <goal>check</goal>
                         </goals>
+                        <phase>verify</phase>
+                        <configuration>
+                            
<includeFilterFile>./dev-support/spotbugsIncludeFile.xml</includeFilterFile>
+                            
<failOnError>${spotbug.failOnViolation}</failOnError>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>

Reply via email to