[java-metadata-aggregator] branch main updated: Add support for SpotBugs command-line actions

Ian Young ian at iay.org.uk
Fri Aug 26 15:37:42 UTC 2022


This is an automated email from the git hooks/post-receive script.

iay pushed a commit to branch main
in repository java-metadata-aggregator.

View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=763d2e62969a8c2637c11f90b16b185e0f891bfd

The following commit(s) were added to refs/heads/main by this push:
     new 763d2e6  Add support for SpotBugs command-line actions
763d2e6 is described below

commit 763d2e62969a8c2637c11f90b16b185e0f891bfd
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Fri Aug 26 16:37:38 2022 +0100

    Add support for SpotBugs command-line actions
    
    Note that the SpotBugs check is intentionally NOT performed as part of the build process to avoid dragging in all the required dependencies. Instead, use spotbugs:check manually when required.
---
 pom.xml                                 | 36 +++++++++++++++++++++++++++++++++
 resources/spotbugs/spotbugs-exclude.xml | 26 ++++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/pom.xml b/pom.xml
index 156382c..39870a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -146,7 +146,43 @@
     </distributionManagement>
 
     <build>
+
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>com.github.spotbugs</groupId>
+                    <artifactId>spotbugs-maven-plugin</artifactId>
+                    <version>4.7.1.1</version>
+                    <dependencies>
+                        <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
+                        <!--
+                        <dependency>
+                            <groupId>com.github.spotbugs</groupId>
+                            <artifactId>spotbugs</artifactId>
+                            <version>4.7.1</version>
+                        </dependency>
+                        -->
+                    </dependencies>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
         <plugins>
+
+            <!--
+                Configuration for spotbugs:* goals called directly
+                from the command line.
+
+                Note that SpotBugs is not part of the normal build, by default.
+            -->
+            <plugin>
+                <groupId>com.github.spotbugs</groupId>
+                <artifactId>spotbugs-maven-plugin</artifactId>
+                <configuration>
+                    <excludeFilterFile>${project.basedir}/../resources/spotbugs/spotbugs-exclude.xml</excludeFilterFile>
+                </configuration>
+            </plugin>
+
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-site-plugin</artifactId>
diff --git a/resources/spotbugs/spotbugs-exclude.xml b/resources/spotbugs/spotbugs-exclude.xml
new file mode 100644
index 0000000..425e6f6
--- /dev/null
+++ b/resources/spotbugs/spotbugs-exclude.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<FindBugsFilter xmlns="https://github.com/spotbugs/filter/3.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0
+        https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
+
+    <!--
+        Exclude test and mock classes, by class name.
+    -->
+    <Match>
+        <Class name="~.*Test"/>
+    </Match>
+    <Match>
+        <Class name="~.*Mock.*"/>
+    </Match>
+
+    <!--
+        This code is not intended to be robust in the face of malicious
+        callers, so exposing internal representations is fine. In the majority
+        of flagged cases, the exposed structure is in any case immutable.
+    -->
+    <Match>
+        <Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
+    </Match>
+
+</FindBugsFilter>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list