diff --git a/src/main/kotlin/com/github/spotbugs/snom/internal/SpotBugsHtmlReport.kt b/src/main/kotlin/com/github/spotbugs/snom/internal/SpotBugsHtmlReport.kt index 37c8a7e8..6b66b14f 100644 --- a/src/main/kotlin/com/github/spotbugs/snom/internal/SpotBugsHtmlReport.kt +++ b/src/main/kotlin/com/github/spotbugs/snom/internal/SpotBugsHtmlReport.kt @@ -63,7 +63,7 @@ abstract class SpotBugsHtmlReport @Inject constructor(objects: ObjectFactory, ta override fun setStylesheet(path: String?) { if (path == null) { - stylesheet.set(null as TextResource) + stylesheet.set(null as TextResource?) } else { val configuration = task .project diff --git a/src/main/kotlin/com/github/spotbugs/snom/internal/SpotBugsRunner.kt b/src/main/kotlin/com/github/spotbugs/snom/internal/SpotBugsRunner.kt index b5a7b639..8f93c61c 100644 --- a/src/main/kotlin/com/github/spotbugs/snom/internal/SpotBugsRunner.kt +++ b/src/main/kotlin/com/github/spotbugs/snom/internal/SpotBugsRunner.kt @@ -19,7 +19,6 @@ import org.gradle.api.file.FileCollection import org.slf4j.LoggerFactory import java.io.File import java.io.IOException -import java.lang.Boolean import java.nio.file.Files import java.nio.file.StandardOpenOption import java.util.* @@ -54,7 +53,7 @@ abstract class SpotBugsRunner { args.add("-sourcepath") args.add(task.sourceDirs.asPath) } - if (task.showProgress.getOrElse(Boolean.FALSE)) { + if (task.showProgress.getOrElse(false)) { args.add("-progress") } task.getRequiredReports().forEach { report -> @@ -81,19 +80,19 @@ abstract class SpotBugsRunner { args.add("-omitVisitors") args.add(task.omitVisitors.get().stream().collect(Collectors.joining(","))) } - if (task.includeFilter.isPresent && task.includeFilter.get() != null) { + if (task.includeFilter.isPresent) { args.add("-include") args.add(task.includeFilter.get().asFile.absolutePath) } - if (task.excludeFilter.isPresent && task.excludeFilter.get() != null) { + if (task.excludeFilter.isPresent) { args.add("-exclude") args.add(task.excludeFilter.get().asFile.absolutePath) } - if (task.baselineFile.isPresent && task.baselineFile.get() != null) { + if (task.baselineFile.isPresent) { args.add("-excludeBugs") args.add(task.baselineFile.get().asFile.absolutePath) } - if (task.onlyAnalyze.isPresent && task.onlyAnalyze.get().isNotEmpty()) { + if (task.onlyAnalyze.isPresent) { args.add("-onlyAnalyze") args.add(task.onlyAnalyze.get().stream().collect(Collectors.joining(","))) }