Ensure there are no unused imports with Spotless rather than Checkstyle (#5457)

This commit is contained in:
Basil Crow authored and GitHub committed 2021-05-07 21:04:58 +01:00
1 parent deb3a82d01
commit 4d5baf46b6
3 files changed
+26 -3

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@ You can read a description of the [building and debugging process here].
If you want simply to build the `jenkins.war` file as fast as possible without tests, run:
```sh
mvn -am -pl war,bom -DskipTests -Dspotbugs.skip clean install
mvn -am -pl war,bom -DskipTests -Dspotbugs.skip -Dspotless.check.skip clean install
```
The WAR file will be created in `war/target/jenkins.war`.
+25 -1
View File
@@ -113,6 +113,7 @@ THE SOFTWARE.
<access-modifier-checker.version>1.21</access-modifier-checker.version>
<junit.jupiter.version>5.7.1</junit.jupiter.version>
<powermock.version>2.0.9</powermock.version>
<spotless.version>2.10.3</spotless.version>
</properties>
<!-- Note that the 'repositories' and 'pluginRepositories' blocks below are actually copy-pasted
@@ -489,7 +490,6 @@ THE SOFTWARE.
<property name="illegalClasses" value="javax.annotation.MatchesPattern.Checker, javax.annotation.Nonnegative.Checker, javax.annotation.Nonnull.Checker, javax.annotation.RegEx.Checker, javax.annotation.CheckForNull, javax.annotation.CheckForSigned, javax.annotation.CheckReturnValue, javax.annotation.Detainted, javax.annotation.MatchesPattern, javax.annotation.Nonnegative, javax.annotation.Nonnull, javax.annotation.Nullable, javax.annotation.OverridingMethodsMustInvokeSuper, javax.annotation.ParametersAreNonnullByDefault, javax.annotation.ParametersAreNullableByDefault, javax.annotation.PropertyKey, javax.annotation.RegEx, javax.annotation.Signed, javax.annotation.Syntax, javax.annotation.Tainted, javax.annotation.Untainted, javax.annotation.WillClose, javax.annotation.WillCloseWhenClosed, javax.annotation.WillNotClose, javax.annotation.concurrent.GuardedBy, javax.annotation.concurrent.Immutable, javax.annotation.concurrent.NotThreadSafe, javax.annotation.concurrent.ThreadSafe, javax.annotation.meta.TypeQualifierValidator, javax.annotation.meta.When, javax.annotation.meta.Exclusive, javax.annotation.meta.Exhaustive, javax.annotation.meta.TypeQualifier, javax.annotation.meta.TypeQualifierDefault, javax.annotation.meta.TypeQualifierNickname" />
</module>
<module name="RedundantImport" />
<module name="UnusedImports" />
<!--
Miscellaneous: https://checkstyle.sourceforge.io/config_misc.html
-->
@@ -515,6 +515,25 @@ THE SOFTWARE.
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>
<configuration>
<java>
<removeUnusedImports />
</java>
</configuration>
<executions>
<execution>
<!-- Runs in verify phase by default -->
<goals>
<!-- Can be disabled using -Dspotless.check.skip -->
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
@@ -612,6 +631,11 @@ THE SOFTWARE.
<artifactId>maven-checkstyle-plugin</artifactId>
<!-- Version specified in parent POM -->
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>
</plugin>
</plugins>
<extensions>
@@ -3,7 +3,6 @@ package jenkins.widgets;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Assert;
import org.junit.Rule;