io.gitlab.arturbosch.detekt.internal.SharedTasks.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of detekt-gradle-plugin Show documentation
Show all versions of detekt-gradle-plugin Show documentation
Static code analysis for Kotlin
package io.gitlab.arturbosch.detekt.internal
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import io.gitlab.arturbosch.detekt.extensions.DetektReport
import org.gradle.api.Project
import org.gradle.api.tasks.TaskProvider
import java.io.File
internal fun Project.registerDetektTask(
name: String,
extension: DetektExtension,
configuration: Detekt.() -> Unit
): TaskProvider =
tasks.register(name, Detekt::class.java) {
it.debugProp.set(provider { extension.debug })
it.parallelProp.set(provider { extension.parallel })
it.disableDefaultRuleSetsProp.set(provider { extension.disableDefaultRuleSets })
it.buildUponDefaultConfigProp.set(provider { extension.buildUponDefaultConfig })
it.failFastProp.set(provider { extension.failFast })
it.autoCorrectProp.set(provider { extension.autoCorrect })
it.config.setFrom(provider { extension.config })
it.ignoreFailuresProp.set(project.provider { extension.ignoreFailures })
configuration(it)
}
internal fun Project.registerCreateBaselineTask(
name: String,
extension: DetektExtension,
configuration: DetektCreateBaselineTask.() -> Unit
): TaskProvider =
tasks.register(name, DetektCreateBaselineTask::class.java) {
it.config.setFrom(project.provider { extension.config })
it.debug.set(project.provider { extension.debug })
it.parallel.set(project.provider { extension.parallel })
it.disableDefaultRuleSets.set(project.provider { extension.disableDefaultRuleSets })
it.buildUponDefaultConfig.set(project.provider { extension.buildUponDefaultConfig })
it.failFast.set(project.provider { extension.failFast })
it.autoCorrect.set(project.provider { extension.autoCorrect })
configuration(it)
}
internal fun DetektReport.setDefaultIfUnset(default: File) {
if (destination == null) {
destination = default
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy