diff --git a/.editorconfig b/.editorconfig index 328a07fc..203d331c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,5 +7,8 @@ indent_style = space insert_final_newline = true trim_trailing_whitespace = true +[*.md] +trim_trailing_whitespace = false + [*.{yml,yaml}] indent_size = 2 \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 2edec043..c9faa7a0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ +import io.gitlab.arturbosch.detekt.Detekt + plugins { groovy - `java-gradle-plugin` jacoco signing kotlin("jvm") version "1.9.21" @@ -14,7 +15,7 @@ plugins { java { toolchain { - languageVersion.set(JavaLanguageVersion.of(11)) + languageVersion = JavaLanguageVersion.of(11) } } @@ -44,7 +45,7 @@ signing { } tasks { - named("detekt") { + named("detekt") { reports { sarif.required = true } @@ -61,7 +62,7 @@ tasks { withType().configureEach { dependsOn(processResources) } - named("javadoc") { + javadoc { enabled = false } } diff --git a/buildSrc/src/main/kotlin/com/github/spotbugs/com.github.spotbugs.gradle-plugin.gradle.kts b/buildSrc/src/main/kotlin/com/github/spotbugs/com.github.spotbugs.gradle-plugin.gradle.kts index 93b2f870..5b612dd8 100644 --- a/buildSrc/src/main/kotlin/com/github/spotbugs/com.github.spotbugs.gradle-plugin.gradle.kts +++ b/buildSrc/src/main/kotlin/com/github/spotbugs/com.github.spotbugs.gradle-plugin.gradle.kts @@ -3,6 +3,12 @@ plugins { } spotless { + groovy { + licenseHeaderFile(rootProject.file("gradle/HEADER.txt")) + target("**/*.groovy") + greclipse() + indentWithSpaces() + } kotlin { ktlint() } diff --git a/gradle.properties b/gradle.properties index 9affcefb..9a77dc81 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,4 @@ org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx4g org.gradle.parallel=true org.gradle.caching=true +org.gradle.configuration-cache=true diff --git a/settings.gradle.kts b/settings.gradle.kts index e74ba51c..5ae8a2ab 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,14 +5,18 @@ pluginManagement { } plugins { - id("com.gradle.enterprise") version("3.15.1") - id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0") + id("com.gradle.enterprise") version "3.15.1" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" } dependencyResolutionManagement { repositories { // To download the Android Gradle Plugin - google() + google { + content { + includeGroupByRegex(".*android.*") + } + } // To download trove4j required by the Android Gradle Plugin mavenCentral() } @@ -29,3 +33,5 @@ gradleEnterprise { publishAlwaysIf(isCiBuild) } } + +enableFeaturePreview("STABLE_CONFIGURATION_CACHE") diff --git a/src/functionalTest/groovy/com/github/spotbugs/snom/CacheabilityFunctionalTest.groovy b/src/functionalTest/groovy/com/github/spotbugs/snom/CacheabilityFunctionalTest.groovy index d440d443..5fbcbb92 100644 --- a/src/functionalTest/groovy/com/github/spotbugs/snom/CacheabilityFunctionalTest.groovy +++ b/src/functionalTest/groovy/com/github/spotbugs/snom/CacheabilityFunctionalTest.groovy @@ -26,7 +26,8 @@ class CacheabilityFunctionalTest extends BaseFunctionalTest { */ @IgnoreIf({ def current = System.getProperty('gradleVersion', GradleVersion.current().version) - return GradleVersion.version(current) < GradleVersion.version("8.1") }) + return GradleVersion.version(current) < GradleVersion.version("8.1") + }) def 'spotbugsMain task runs with configuration cache'() { given: initializeBuildFile(rootDir) diff --git a/src/functionalTest/groovy/com/github/spotbugs/snom/KotlinBuildScriptFunctionalTest.groovy b/src/functionalTest/groovy/com/github/spotbugs/snom/KotlinBuildScriptFunctionalTest.groovy index f056e8c8..753726eb 100644 --- a/src/functionalTest/groovy/com/github/spotbugs/snom/KotlinBuildScriptFunctionalTest.groovy +++ b/src/functionalTest/groovy/com/github/spotbugs/snom/KotlinBuildScriptFunctionalTest.groovy @@ -52,7 +52,8 @@ public class Foo { @IgnoreIf({ def current = System.getProperty('gradleVersion', GradleVersion.current().version) - return GradleVersion.version(current) < GradleVersion.version("8.2") }) + return GradleVersion.version(current) < GradleVersion.version("8.2") + }) def "can set params to SpotBugsExtension"() { setup: buildFile << """ @@ -126,7 +127,8 @@ dependencies { @IgnoreIf({ def current = System.getProperty('gradleVersion', GradleVersion.current().version) - return GradleVersion.version(current) < GradleVersion.version("8.2") }) + return GradleVersion.version(current) < GradleVersion.version("8.2") + }) def "can generate spotbugs.html in configured outputLocation"() { buildFile << """ tasks.spotbugsMain { diff --git a/src/main/kotlin/com/github/spotbugs/snom/SpotBugsExtension.kt b/src/main/kotlin/com/github/spotbugs/snom/SpotBugsExtension.kt index 206440ad..e4a1c9e6 100644 --- a/src/main/kotlin/com/github/spotbugs/snom/SpotBugsExtension.kt +++ b/src/main/kotlin/com/github/spotbugs/snom/SpotBugsExtension.kt @@ -81,7 +81,7 @@ interface SpotBugsExtension { /** * Property to set the directory to generate report files. Default is `"$buildDir/reports/spotbugs"`. * - * Note that each [SpotBugsTask] creates own sub-directory in this directory. + * Note that each [SpotBugsTask] creates own subdirectory in this directory. */ val reportsDir: DirectoryProperty diff --git a/src/main/kotlin/com/github/spotbugs/snom/SpotBugsReport.kt b/src/main/kotlin/com/github/spotbugs/snom/SpotBugsReport.kt index 368c97bb..29bb8126 100644 --- a/src/main/kotlin/com/github/spotbugs/snom/SpotBugsReport.kt +++ b/src/main/kotlin/com/github/spotbugs/snom/SpotBugsReport.kt @@ -97,6 +97,7 @@ abstract class SpotBugsReport } } + @Suppress("MemberVisibilityCanBePrivate") fun configure(action: Action): Report { action.execute(this) return this diff --git a/src/main/kotlin/com/github/spotbugs/snom/SpotBugsTask.kt b/src/main/kotlin/com/github/spotbugs/snom/SpotBugsTask.kt index dae3e4f9..f59062e1 100644 --- a/src/main/kotlin/com/github/spotbugs/snom/SpotBugsTask.kt +++ b/src/main/kotlin/com/github/spotbugs/snom/SpotBugsTask.kt @@ -312,8 +312,8 @@ abstract class SpotBugsTask : DefaultTask(), VerificationTask { else -> throw InvalidUserDataException("$name is invalid as the report name") } } - setDescription("Run SpotBugs analysis.") - setGroup(JavaBasePlugin.VERIFICATION_GROUP) + description = "Run SpotBugs analysis." + group = JavaBasePlugin.VERIFICATION_GROUP } /** diff --git a/src/main/kotlin/com/github/spotbugs/snom/internal/OutputScanner.kt b/src/main/kotlin/com/github/spotbugs/snom/internal/OutputScanner.kt index 0aab98a3..12dd558a 100644 --- a/src/main/kotlin/com/github/spotbugs/snom/internal/OutputScanner.kt +++ b/src/main/kotlin/com/github/spotbugs/snom/internal/OutputScanner.kt @@ -24,7 +24,6 @@ import java.io.OutputStream internal class OutputScanner(out: OutputStream) : FilterOutputStream(out) { private val builder = ByteArrayOutputStream() var isFailedToReport = false - get() = field override fun write( b: ByteArray,