io.gitlab.arturbosch.detekt.extensions.DetektExtension.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.extensions
import org.gradle.api.Action
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.model.ObjectFactory
import org.gradle.api.plugins.quality.CodeQualityExtension
import java.io.File
import javax.inject.Inject
open class DetektExtension @Inject constructor(objects: ObjectFactory) : CodeQualityExtension() {
var ignoreFailures: Boolean
@JvmName("ignoreFailures_")
get() = isIgnoreFailures
@JvmName("ignoreFailures_")
set(value) {
isIgnoreFailures = value
}
val customReportsDir: File?
get() = reportsDir
val reports = DetektReports()
var input: ConfigurableFileCollection =
objects.fileCollection().from(DEFAULT_SRC_DIR_JAVA, DEFAULT_SRC_DIR_KOTLIN)
var baseline: File? = null
var config: ConfigurableFileCollection = objects.fileCollection()
var debug: Boolean = DEFAULT_DEBUG_VALUE
var parallel: Boolean = DEFAULT_PARALLEL_VALUE
var failFast: Boolean = DEFAULT_FAIL_FAST_VALUE
var buildUponDefaultConfig: Boolean = DEFAULT_BUILD_UPON_DEFAULT_CONFIG_VALUE
var disableDefaultRuleSets: Boolean = DEFAULT_DISABLE_RULESETS_VALUE
var autoCorrect: Boolean = DEFAULT_AUTO_CORRECT_VALUE
/**
* List of Android build variants for which no detekt task should be created.
*
* This is a combination of build types and flavors, such as fooDebug or barRelease.
*/
var ignoredVariants: List = emptyList()
/**
* List of Android build types for which no detekt task should be created.
*/
var ignoredBuildTypes: List = emptyList()
/**
* List of Android build flavors for which no detekt task should be created
*/
var ignoredFlavors: List = emptyList()
fun reports(configure: Action) = configure.execute(reports)
companion object {
const val DEFAULT_SRC_DIR_JAVA = "src/main/java"
const val DEFAULT_SRC_DIR_KOTLIN = "src/main/kotlin"
const val DEFAULT_DEBUG_VALUE = false
const val DEFAULT_PARALLEL_VALUE = false
const val DEFAULT_AUTO_CORRECT_VALUE = false
const val DEFAULT_DISABLE_RULESETS_VALUE = false
const val DEFAULT_REPORT_ENABLED_VALUE = true
const val DEFAULT_FAIL_FAST_VALUE = false
const val DEFAULT_BUILD_UPON_DEFAULT_CONFIG_VALUE = false
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy