aboutsummaryrefslogtreecommitdiffstats
path: root/spotbugs
diff options
context:
space:
mode:
authorClaudio David Gasparini <claudio.gasparini@pantheon.tech>2020-12-18 14:37:27 +0100
committerClaudio David Gasparini <claudio.gasparini@pantheon.tech>2021-01-11 09:16:56 +0000
commit9f93f7960c97642a79ed30b84d5127017ed9fc73 (patch)
tree628376c80ac17039ca30e507889f24e9f8124630 /spotbugs
parent5a8718b84dbd3c6fa78aa644a4695274a0a1ab5d (diff)
Introduce spotbug plugin
Issue-ID: CPS-159 Signed-off-by: Claudio David Gasparini <claudio.gasparini@pantheon.tech> Change-Id: I889b3009505421621007031fb99a43c5cd30be82
Diffstat (limited to 'spotbugs')
-rw-r--r--spotbugs/pom.xml28
-rw-r--r--spotbugs/src/main/resources/spotbugs-exclude.xml27
2 files changed, 55 insertions, 0 deletions
diff --git a/spotbugs/pom.xml b/spotbugs/pom.xml
new file mode 100644
index 0000000000..133c4f7319
--- /dev/null
+++ b/spotbugs/pom.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.onap.cps</groupId>
+ <artifactId>spotbugs</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <properties>
+ <nexusproxy>https://nexus.onap.org</nexusproxy>
+ <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
+ <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
+ </properties>
+
+ <distributionManagement>
+ <repository>
+ <id>ecomp-releases</id>
+ <name>ECOMP Release Repository</name>
+ <url>${nexusproxy}${releaseNexusPath}</url>
+ </repository>
+ <snapshotRepository>
+ <id>ecomp-snapshots</id>
+ <name>ECOMP Snapshot Repository</name>
+ <url>${nexusproxy}${snapshotNexusPath}</url>
+ </snapshotRepository>
+ </distributionManagement>
+</project> \ No newline at end of file
diff --git a/spotbugs/src/main/resources/spotbugs-exclude.xml b/spotbugs/src/main/resources/spotbugs-exclude.xml
new file mode 100644
index 0000000000..c46270c1cd
--- /dev/null
+++ b/spotbugs/src/main/resources/spotbugs-exclude.xml
@@ -0,0 +1,27 @@
+<FindBugsFilter>
+ <Match>
+ <Or>
+ <!-- Anonymous inner classes are very common. -->
+ <Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON" />
+
+ <!-- We use static slf4j Logger (this rule is from KengoTODA/findbugs-slf4j jp.skypencil.findbugs.slf4:bug-pattern) -->
+ <Bug pattern="SLF4J_LOGGER_SHOULD_BE_NON_STATIC" />
+
+ <!-- Guava 25.1+ uses the Checker Framework's @Nullable which SpotBugs doesn't handle correctly, even though it's
+ supposed to; see https://github.com/spotbugs/spotbugs/issues/743 -->
+ <Bug pattern="NP_NONNULL_PARAM_VIOLATION" />
+ <Bug pattern="NP_NULL_PARAM_DEREF" />
+ <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE" />
+ <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" />
+
+ <!-- https://github.com/spotbugs/spotbugs/issues/511. Strict reading of Object.equals() contract means that
+ evenever equals() behaviour is defined, all implementations need to adhere to it. The only reason
+ to override the method (assuming correct API design, of course) is to provide a more efficient
+ implementation. This rule would be forcing a @SuppressFBWarnings on perfectly compliant classes. -->
+ <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+
+ <!-- https://github.com/spotbugs/spotbugs/issues/756. spotbugs does not grok Java 11's try-with-resources -->
+ <Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
+ </Or>
+ </Match>
+</FindBugsFilter>