Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib-extra/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,5 @@ p2deps {
spotbugs {
// LOW|MEDIUM|DEFAULT|HIGH (low = sensitive to even minor mistakes).
reportLevel = com.github.spotbugs.snom.Confidence.valueOf('LOW')
excludeFilter = file("spotbugs-exclude.xml")
}
8 changes: 8 additions & 0 deletions lib-extra/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<FindBugsFilter>
<Match>
<Bug pattern="THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION"/>
</Match>
<Match>
<Bug pattern="THROWS_METHOD_THROWS_RUNTIMEEXCEPTION"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ static class RuntimeInit {
/** git worktree root, might not exist if we're not in a git repo. */
final @Nullable File workTree;

@SuppressFBWarnings("SIC_INNER_SHOULD_BE_STATIC_ANON")
RuntimeInit(File projectDir) {
/////////////////////////////////
// USER AND SYSTEM-WIDE VALUES //
Expand Down
1 change: 1 addition & 0 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ dependencies {
spotbugs {
// LOW|MEDIUM|DEFAULT|HIGH (low = sensitive to even minor mistakes).
reportLevel = com.github.spotbugs.snom.Confidence.valueOf('LOW')
excludeFilter = file("spotbugs-exclude.xml")
}

apply from: rootProject.file('gradle/special-tests.gradle')
Expand Down
8 changes: 8 additions & 0 deletions lib/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<FindBugsFilter>
<Match>
<Bug pattern="THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION"/>
</Match>
<Match>
<Bug pattern="THROWS_METHOD_THROWS_RUNTIMEEXCEPTION"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

import com.diffplug.spotless.yaml.SerializeToByteArrayHack;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Gradle requires three things:
* - Gradle defines cache equality based on your serialized representation
Expand Down Expand Up @@ -78,7 +76,6 @@ private void writeObject(java.io.ObjectOutputStream out) throws IOException {
}
}

@SuppressFBWarnings("MC_OVERRIDABLE_METHOD_CALL_IN_READ_OBJECT")
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
boolean serializeToByteArrayFirst = in.readBoolean();
optimizeForEquality = in.readBoolean();
Expand Down
5 changes: 1 addition & 4 deletions lib/src/main/java/com/diffplug/spotless/ProcessRunner.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2024 DiffPlug
* Copyright 2020-2025 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,8 +37,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Shelling out to a process is harder than it ought to be in Java.
* If you don't read stdout and stderr on their own threads, you risk
Expand Down Expand Up @@ -195,7 +193,6 @@ private void checkState() {
}
}

@SuppressFBWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
public static class Result {
private final List<String> args;
private final int exitCode;
Expand Down
6 changes: 1 addition & 5 deletions lib/src/main/java/com/diffplug/spotless/SpotlessCache.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2025 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,8 +30,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Spotless' global cache. {@link SpotlessCache#clear()} should be called
* when Spotless is no longer in use to release any resources it has grabbed.
Expand Down Expand Up @@ -64,12 +62,10 @@ public final int hashCode() {

final Map<SerializedKey, URLClassLoader> cache = new HashMap<>();

@SuppressFBWarnings("DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED")
synchronized ClassLoader classloader(JarState state) {
return classloader(state, state);
}

@SuppressFBWarnings("DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED")
synchronized ClassLoader classloader(Serializable key, JarState state) {
SerializedKey serializedKey = new SerializedKey(key);
return cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import com.diffplug.spotless.LineEnding;
import com.diffplug.spotless.Lint;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public class FenceStep {
/** Declares the name of the step. */
public static FenceStep named(String name) {
Expand Down Expand Up @@ -135,7 +133,6 @@ public BaseFormatter toFormatterFunc() {
}
}

@SuppressFBWarnings("SE_TRANSIENT_FIELD_NOT_RESTORED")
private static class BaseFormatter implements FormatterFunc.NeedsFile, FormatterFunc.Closeable {
final Kind kind;
final Pattern regex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2024 DiffPlug
* Copyright 2016-2025 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,8 +40,6 @@
import com.diffplug.spotless.FormatterStep;
import com.diffplug.spotless.SerializedFunction;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public final class ImportOrderStep implements Serializable {
private static final long serialVersionUID = 1L;
private static final boolean WILDCARDS_LAST_DEFAULT = false;
Expand Down Expand Up @@ -94,7 +92,6 @@ private FormatterStep createFrom(boolean wildcardsLast, boolean semanticSort, Se
State::toFormatter);
}

@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE") // workaround https://github.com/spotbugs/spotbugs/issues/756
private static List<String> getImportOrder(File importsFile) {
try (Stream<String> lines = Files.lines(importsFile.toPath())) {
return lines.filter(line -> !line.startsWith("#"))
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
// https://github.com/gradle-nexus/publish-plugin/releases
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' apply false
// https://github.com/spotbugs/spotbugs-gradle-plugin/releases
id 'com.github.spotbugs' version '6.1.13' apply false
id 'com.github.spotbugs' version '6.2.2' apply false
// https://github.com/diffplug/spotless-changelog/blob/main/CHANGELOG.md
id 'com.diffplug.spotless-changelog' version '3.1.2' apply false
// https://github.com/radarsh/gradle-test-logger-plugin/blob/develop/CHANGELOG.md
Expand Down
Loading