Skip to content

Commit

Permalink
Merge pull request #227 from CherryPerry/detekt
Browse files Browse the repository at this point in the history
Configure detekt
  • Loading branch information
Arkadii Ivanov committed Oct 16, 2019
2 parents 2f3c89b + e224c2f commit ed2ca70
Show file tree
Hide file tree
Showing 48 changed files with 727 additions and 43 deletions.
1 change: 1 addition & 0 deletions build.gradle
Expand Up @@ -16,6 +16,7 @@ allprojects {
void setupMultiplatformLibrary(Project project) {
project.apply plugin: 'org.jetbrains.kotlin.multiplatform'
project.apply plugin: 'maven-publish'
project.apply plugin: DetektPlugin

project.group = reaktive_group_id
project.version = reaktive_version
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/build.gradle.kts
Expand Up @@ -5,6 +5,7 @@ plugins {
repositories {
google()
jcenter()
gradlePluginPortal()
}

apply(from = "../gradle/versions.gradle.kts")
Expand All @@ -14,4 +15,5 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${property("kotlin_version")}")
implementation("com.android.tools.build:gradle:${property("android_gradle_version")}")
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:${property("bintray_gradle_version")}")
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.1.0")
}
19 changes: 19 additions & 0 deletions buildSrc/src/main/kotlin/DetektPlugin.kt
@@ -0,0 +1,19 @@
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.gradle.api.Plugin
import org.gradle.api.Project

abstract class DetektPlugin : Plugin<Project> {

override fun apply(target: Project) {
target.plugins.apply("io.gitlab.arturbosch.detekt")
target.extensions.configure(DetektExtension::class.java) {
input = target.files(
target
.file("src")
.listFiles()
?.filter { it.isDirectory && it.name.endsWith("main", ignoreCase = true) }
)
config = target.rootProject.files("detekt.yml")
}
}
}
Expand Up @@ -41,8 +41,10 @@ internal actual inline fun <T> launchCoroutine(
private fun CoroutineScope.launchWatchdog(disposable: Disposable) {
launch {
while (!disposable.isDisposed) {
delay(100L)
delay(COROUTINE_DELAY_CHECK_MS)
}
this@launchWatchdog.cancel()
}
}
}

private const val COROUTINE_DELAY_CHECK_MS = 100L

0 comments on commit ed2ca70

Please sign in to comment.