Skip to content

Commit a31709f

Browse files
committed
Update SpotBugs
1 parent 4f540a2 commit a31709f

File tree

15 files changed

+42
-13
lines changed

15 files changed

+42
-13
lines changed

code-providers/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
<version>1.3.0</version>
4343
</dependency>
4444

45+
<dependency>
46+
<!-- https://stackoverflow.com/questions/1829904/is-there-a-way-to-ignore-a-single-findbugs-warning -->
47+
<groupId>com.google.code.findbugs</groupId>
48+
<artifactId>annotations</artifactId>
49+
<version>3.0.1u2</version>
50+
<scope>provided</scope>
51+
</dependency>
52+
4553
<dependency>
4654
<groupId>io.github.solven-eu.cleanthat</groupId>
4755
<artifactId>test-helpers</artifactId>

code-providers/src/main/java/eu/solven/cleanthat/code_provider/inmemory/FileSystemCodeProvider.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
import com.google.common.jimfs.Jimfs;
4040

41+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
4142
import eu.solven.cleanthat.code_provider.CleanthatPathHelpers;
4243
import eu.solven.cleanthat.codeprovider.CodeProviderHelpers;
4344
import eu.solven.cleanthat.codeprovider.DummyCodeProviderFile;
@@ -58,6 +59,8 @@ public class FileSystemCodeProvider implements ICodeProviderWriter {
5859
final Path root;
5960
final Charset charset;
6061

62+
@SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW",
63+
justification = "We need to derive this class in FileSystemGitCodeProvider")
6164
public FileSystemCodeProvider(Path root, Charset charset) {
6265
this.fs = root.getFileSystem();
6366
this.root = root.normalize();
@@ -131,7 +134,7 @@ public String toString() {
131134
return root.toAbsolutePath().toString();
132135
}
133136

134-
protected Path resolvePath(Path inMemoryPath) {
137+
private Path resolvePath(Path inMemoryPath) {
135138
return CleanthatPathHelpers.resolveChild(root, inMemoryPath);
136139
}
137140

@@ -171,7 +174,7 @@ public Optional<String> loadContentForPath(Path path) throws IOException {
171174
return safeReadString(pathForRootFS);
172175
}
173176

174-
protected Optional<String> safeReadString(Path pathForRootFS) throws IOException {
177+
private Optional<String> safeReadString(Path pathForRootFS) throws IOException {
175178
if (Files.exists(pathForRootFS)) {
176179
String asString;
177180
try {

code-providers/src/main/java/eu/solven/cleanthat/codeprovider/DummyCodeProviderFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @author Benoit Lacelle
2626
*
2727
*/
28-
public class DummyCodeProviderFile implements ICodeProviderFile {
28+
public final class DummyCodeProviderFile implements ICodeProviderFile {
2929
private final Path path;
3030
private final Object raw;
3131

code-providers/src/main/java/eu/solven/cleanthat/codeprovider/git/GitRepoBranchSha1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
*/
2727
// https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#webhook-payload-example-32
28-
public class GitRepoBranchSha1 {
28+
public final class GitRepoBranchSha1 {
2929
final String repoName;
3030
final String ref;
3131
final String sha;

code-providers/src/main/java/eu/solven/cleanthat/codeprovider/git/GitWebhookRelevancyResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* @author Benoit Lacelle
2424
*
2525
*/
26-
public class GitWebhookRelevancyResult implements IExternalWebhookRelevancyResult {
26+
public final class GitWebhookRelevancyResult implements IExternalWebhookRelevancyResult {
2727
final boolean rrOpen;
2828
final boolean pushRef;
2929
final Optional<GitRepoBranchSha1> optRef;

config/src/main/java/eu/solven/cleanthat/utils/ResultOrError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @param <R>
2626
* @param <E>
2727
*/
28-
public class ResultOrError<R, E> {
28+
public final class ResultOrError<R, E> {
2929
final Optional<R> optResult;
3030
final Optional<E> optError;
3131

github/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@
8787
<groupId>com.squareup.okhttp3</groupId>
8888
<artifactId>okhttp</artifactId>
8989
</dependency>
90+
91+
<dependency>
92+
<!-- https://stackoverflow.com/questions/1829904/is-there-a-way-to-ignore-a-single-findbugs-warning -->
93+
<groupId>com.google.code.findbugs</groupId>
94+
<artifactId>annotations</artifactId>
95+
<version>3.0.1u2</version>
96+
<scope>provided</scope>
97+
</dependency>
98+
9099
<dependency>
91100
<!-- Enables loading a PEM file -->
92101
<groupId>org.bouncycastle</groupId>

github/src/main/java/eu/solven/cleanthat/code_provider/github/event/GithubAppFactory.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import com.nimbusds.jose.crypto.impl.RSAKeyUtils;
4444
import com.nimbusds.jose.jwk.RSAKey;
4545

46+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
4647
import eu.solven.cleanthat.code_provider.github.event.pojo.WebhookRelevancyResult;
4748
import eu.solven.cleanthat.utils.ResultOrError;
4849
import okhttp3.OkHttpClient;
@@ -53,6 +54,8 @@
5354
* @author Benoit Lacelle
5455
*
5556
*/
57+
// https://github.com/spotbugs/spotbugs/issues/2695
58+
@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
5659
public class GithubAppFactory implements IGithubAppFactory {
5760
private static final int PUBLIC_CHARS_IN_TOKEN = 10;
5861

@@ -108,7 +111,7 @@ private ImmutableMap<String, GHPermissionType> getRequestedPermissions() {
108111
.build();
109112
}
110113

111-
protected GitHub makeInstallationGithub(GitHub github, String appToken) throws IOException {
114+
private GitHub makeInstallationGithub(GitHub github, String appToken) throws IOException {
112115
GitHubConnector ghConnector = createGithubConnector();
113116
return new GitHubBuilder().withEndpoint(github.getApiUrl())
114117
.withAppInstallationToken(appToken)

github/src/main/java/eu/solven/cleanthat/code_provider/github/event/GithubWebhookHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
*/
6060
// https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads
6161
@SuppressWarnings("PMD.GodClass")
62-
public class GithubWebhookHandler implements IGithubWebhookHandler {
62+
public final class GithubWebhookHandler implements IGithubWebhookHandler {
6363
private static final String EOL = "\r\n";
6464

6565
private static final Logger LOGGER = LoggerFactory.getLogger(GithubWebhookHandler.class);
@@ -100,7 +100,7 @@ public GHApp getGithubAsApp() {
100100
* @return an {@link Optional} rejection reason
101101
* @throws IOException
102102
*/
103-
protected Optional<String> checkMarketPlacePlan(GHAppInstallation appInstallation, GHRepository ghRepository)
103+
private Optional<String> checkMarketPlacePlan(GHAppInstallation appInstallation, GHRepository ghRepository)
104104
throws IOException {
105105
// https://github.com/hub4j/github-api/issues/1613
106106
GHMarketplaceAccount account = appInstallation.getMarketplaceAccount();

github/src/main/java/eu/solven/cleanthat/code_provider/github/refs/AGithubDiffCodeProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.google.common.base.Supplier;
3333
import com.google.common.base.Suppliers;
3434

35+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3536
import eu.solven.cleanthat.code_provider.CleanthatPathHelpers;
3637
import eu.solven.cleanthat.code_provider.github.code_provider.AGithubCodeProvider;
3738
import eu.solven.cleanthat.code_provider.github.code_provider.FileIsTooBigException;
@@ -56,6 +57,7 @@ public abstract class AGithubDiffCodeProvider extends AGithubCodeProvider implem
5657

5758
final Supplier<GHCompare> diffSupplier;
5859

60+
@SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW", justification = "Unclear FB case")
5961
public AGithubDiffCodeProvider(Path repositoryRoot, String token, GHRepository baseRepository) {
6062
super(repositoryRoot);
6163
this.token = token;

0 commit comments

Comments
 (0)