Skip to content

Commit

Permalink
Spotbugs config
Browse files Browse the repository at this point in the history
  • Loading branch information
will-molloy committed Jul 1, 2023
1 parent 27adc58 commit d5156fa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
13 changes: 9 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort
import com.github.spotbugs.snom.SpotBugsExtension
import com.github.spotbugs.snom.SpotBugsTask
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
Expand Down Expand Up @@ -49,14 +51,17 @@ subprojects {
}

// SpotBugs (static analysis - find possible bugs, performance issues etc.)
// TODO working? test on another project
apply(plugin = "com.github.spotbugs")
configure<SpotBugsExtension> {
// TODO
effort.set(Effort.MAX)
reportLevel.set(Confidence.LOW)
ignoreFailures.set(false)
excludeFilter.set(rootProject.file("./spotbugs-exclude.xml"))
}
tasks.withType<SpotBugsTask> {
reports {
// TODO
}
reports.create("xml").required.set(true)
reports.create("html").required.set(true)
}

tasks.withType<Test> {
Expand Down
4 changes: 2 additions & 2 deletions hello-world/src/main/java/com/willmolloy/HelloWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
*
* @author <a href=https://willmolloy.com>Will Molloy</a>
*/
public class HelloWorld {
class HelloWorld {

private final Logger log = LogManager.getLogger();

public String hello(String text) {
String hello(String text) {
log.debug("Hello {}!", text);
return "Hello %s!".formatted(text);
}
Expand Down
5 changes: 0 additions & 5 deletions spotbugs-exclude.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>

<!-- False positive with records -->
<Match>
<Bug pattern="EQ_UNUSUAL" />
</Match>

</FindBugsFilter>

0 comments on commit d5156fa

Please sign in to comment.