From c2faeffd840aaf3eec138e79151576f010a24f29 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 17 Jul 2022 00:55:12 +0530 Subject: detekt: init --- build-logic/kotlin-plugins/build.gradle.kts | 1 + .../kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt | 15 +++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'build-logic/kotlin-plugins') diff --git a/build-logic/kotlin-plugins/build.gradle.kts b/build-logic/kotlin-plugins/build.gradle.kts index d7e798b7..d891ec0d 100644 --- a/build-logic/kotlin-plugins/build.gradle.kts +++ b/build-logic/kotlin-plugins/build.gradle.kts @@ -60,6 +60,7 @@ gradlePlugin { dependencies { implementation(libs.build.agp) implementation(libs.build.binarycompat) + implementation(libs.build.detekt) implementation(libs.build.kotlin) implementation(libs.build.r8) implementation(libs.build.spotless) diff --git a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt index 50d67e52..7327e8af 100644 --- a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt +++ b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt @@ -5,12 +5,15 @@ package app.passwordstore.gradle +import io.gitlab.arturbosch.detekt.DetektPlugin +import io.gitlab.arturbosch.detekt.extensions.DetektExtension import org.gradle.api.JavaVersion import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.testing.Test import org.gradle.api.tasks.testing.logging.TestLogEvent +import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.withType import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -18,6 +21,18 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile class KotlinCommonPlugin : Plugin { override fun apply(project: Project) { + project.pluginManager.apply(DetektPlugin::class.java) + project.extensions.configure { + parallel = true + ignoredBuildTypes = listOf("release") + ignoredFlavors = listOf("free") + basePath = project.layout.projectDirectory.toString() + baseline = + project.rootProject.layout.projectDirectory + .dir("detekt-baselines") + .file("${project.name}.xml") + .asFile + } project.tasks.run { withType().configureEach { sourceCompatibility = JavaVersion.VERSION_11.toString() -- cgit v1.2.3