Aktualisierung der PMD / Spotbugs Konfiguration.

This commit is contained in:
Konrad Neitzel 2022-08-13 16:56:28 +02:00
parent 675de7d70b
commit ce9e0f96b2
3 changed files with 50 additions and 6 deletions

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Custom Java Ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
Custom ruleset for Java
@ -14,11 +14,26 @@
<exclude name="SystemPrintln" />
</rule>
<rule ref="category/java/codestyle.xml" />
<rule ref="category/java/codestyle.xml">
<!-- That is not my code style! -->
<exclude name="AtLeastOneConstructor" />
<rule ref="category/java/design.xml" />
<!-- long variables are acceptable -->
<exclude name="LongVariable"/>
<rule ref="category/java/documentation.xml" />
<!-- Multiple return statements are ok -->
<exclude name="OnlyOneReturn"/>
</rule>
<rule ref="category/java/design.xml">
<!-- Problems with builder and streams/lambdas -->
<exclude name="LawOfDemeter" />
</rule>
<rule ref="category/java/documentation.xml">
<!-- Long comments are not a problem! -->
<exclude name="CommentSize"/>
</rule>
<rule ref="category/java/errorprone.xml" />
@ -28,4 +43,11 @@
<rule ref="category/java/security.xml" />
<rule ref="category/java/design.xml/LoosePackageCoupling">
<properties>
<property name="packages">
<value>de.kneitzel</value>
</property>
</properties>
</rule>
</ruleset>

14
pom.xml
View File

@ -74,6 +74,7 @@
<build>
<plugins>
<!-- Enforcer to enforce min Maven version -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
@ -95,6 +96,7 @@
</executions>
</plugin>
<!-- Compiler including Lobok -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@ -111,6 +113,7 @@
</configuration>
</plugin>
<!-- Test execution -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@ -120,6 +123,7 @@
</configuration>
</plugin>
<!-- Copy dependencies -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@ -140,6 +144,8 @@
</execution>
</executions>
</plugin>
<!-- Build image -->
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
@ -204,6 +210,8 @@
</execution>
</executions>
</plugin>
<!-- Build JPackage App-Image -->
<plugin>
<groupId>com.github.akman</groupId>
<artifactId>jpackage-maven-plugin</artifactId>
@ -224,6 +232,7 @@
</executions>
</plugin>
<!-- Spotbugs Code Analyzer -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
@ -248,8 +257,12 @@
</goals>
</execution>
</executions>
<configuration>
<excludeFilterFile>spotbugs-exclude-filter.xml</excludeFilterFile>
</configuration>
</plugin>
<!-- PMD static code analysis -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
@ -298,6 +311,7 @@
</executions>
</plugin>
<!-- Check for new versions in dependencies -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>

View File

@ -0,0 +1,8 @@
<FindBugsFilter>
<Match>
<!-- We store references we get from outside and we give stored references to the outside -->
<!-- EI: May expose internal representation by returning reference to mutable object -->
<!-- EI2: May expose internal representation by incorporating reference to mutable object -->
<Bug code="EI,EI2"/>
</Match>
</FindBugsFilter>