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

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

commit aa5f2fb58b23648858f0b51a13542643f4640aa0
Author: Abhishek Kumar <[email protected]>
AuthorDate: Tue Dec 10 14:18:02 2024 -0800

    RANGER-5019: Fix spotbug checks for sub-modules (#441)
    
    It fixes mvn builds at sub-module level and allows 'mvn install' to run at 
every submodule.
    
    (cherry picked from commit 9930255638985f1e0afa5481c54cebfba1fe3def)
---
 agents-common/dev-support/spotbugsIncludeFile.xml  | 64 ----------------------
 kms/dev-support/findbugsExcludeFile.xml            | 48 ----------------
 pom.xml                                            | 10 +++-
 .../dev-support/findbugsIncludeFile.xml            | 25 ---------
 security-admin/pom.xml                             |  4 +-
 5 files changed, 9 insertions(+), 142 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/kms/dev-support/findbugsExcludeFile.xml 
b/kms/dev-support/findbugsExcludeFile.xml
deleted file mode 100644
index 929936dad..000000000
--- a/kms/dev-support/findbugsExcludeFile.xml
+++ /dev/null
@@ -1,48 +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>
-  <!--
-    Findbug is complaining about System.out being NULL
-  -->
-  <Match>
-    <Class name="org.apache.hadoop.crypto.key.kms.server.KMSWebApp"/>
-    <Bug pattern="NP_ALWAYS_NULL"/>
-  </Match>
-  <!--
-    KMSWebApp is a webapp singleton managed by the servlet container via
-    ServletContextListener.
-  -->
-  <Match>
-    <Class name="org.apache.hadoop.crypto.key.kms.server.KMSWebApp"/>
-    <Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
-  </Match>
-  <!--
-    KMSWebApp does an exit to kill the servlet container if the initialization
-    fails.
-  -->
-  <Match>
-    <Class name="org.apache.hadoop.crypto.key.kms.server.KMSWebApp"/>
-    <Bug pattern="DM_EXIT"/>
-  </Match>
-  <!--
-    KMS wants to log the exception before it's thrown to tomcat and disappear.
-  -->
-  <Match>
-    <Class name="org.apache.hadoop.crypto.key.kms.server.KMS"/>
-    <Bug pattern="REC_CATCH_EXCEPTION"/>
-  </Match>
-</FindBugsFilter>
diff --git a/pom.xml b/pom.xml
index 8329cd4fa..8dd293da1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -203,6 +203,7 @@
         <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
         <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
         <sonar.language>java</sonar.language>
+        <spotbugs.failOnViolation>false</spotbugs.failOnViolation>
         <spotbugs.plugin.version>4.7.3.5</spotbugs.plugin.version>
         <spring-ldap-core.version>2.4.1</spring-ldap-core.version>
         
<springframework.security.version>5.7.12</springframework.security.version>
@@ -659,14 +660,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>
+                            
<failOnError>${spotbugs.failOnViolation}</failOnError>
+                            
<includeFilterFile>./dev-support/spotbugsIncludeFile.xml</includeFilterFile>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>
diff --git a/ranger-examples/dev-support/findbugsIncludeFile.xml 
b/ranger-examples/dev-support/findbugsIncludeFile.xml
deleted file mode 100644
index 8623906bd..000000000
--- a/ranger-examples/dev-support/findbugsIncludeFile.xml
+++ /dev/null
@@ -1,25 +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>
-    <Bug Rank="1" />
-  </Match>
-
-</FindBugsFilter>
diff --git a/security-admin/pom.xml b/security-admin/pom.xml
index 16194a3b9..12f9019f8 100644
--- a/security-admin/pom.xml
+++ b/security-admin/pom.xml
@@ -1208,7 +1208,7 @@
                             <rules>
                                 <evaluateBeanshell>
                                     <message>Looks like there are multiple SQL 
files with same version number prefix. Update prefix and build again.</message>
-                                    <condition>List sqlFilePaths = 
org.codehaus.plexus.util.FileUtils.getFileNames(new File("security-admin/db"), 
"**/*.sql", null, false);
+                                    <condition>List sqlFilePaths = 
org.codehaus.plexus.util.FileUtils.getFileNames(new 
File("${project.basedir}/db"), "**/*.sql", null, false);
                                         Map sqlFileMap    = new HashMap();
                                         Boolean noDupPrfx = true;
 
@@ -1255,7 +1255,7 @@
                             <rules>
                                 <evaluateBeanshell>
                                     <message>Looks like there are multiple 
JAVA files with same version number suffix. Update suffix and build 
again.</message>
-                                    <condition>List javaFilePaths  = 
org.codehaus.plexus.util.FileUtils.getFileNames(new 
File("security-admin/src/main/java/org/apache/ranger/patch"), "**/*.java", 
null, false);
+                                    <condition>List javaFilePaths  = 
org.codehaus.plexus.util.FileUtils.getFileNames(new 
File("${project.basedir}/src/main/java/org/apache/ranger/patch"), "**/*.java", 
null, false);
                                         Map javaFileMap     = new HashMap();
                                         Boolean noDupSuffix = true;
 

Reply via email to