detekt compiler plugin
0.4.0
detekt-compiler-plugin的开发已移至Detekt Repo
将Detekt作为Kotlin编译器插件集成的实验支持

plugins {
id( " io.github.detekt.gradle.compiler-plugin " ) version " 0.4.0 "
}
detekt {
isEnabled = true // or with a property: System.getProperty("runDetekt") != null
// everything from https://detekt.github.io/detekt/kotlindsl.html#options-for-detekt-configuration-closure
// is supported to declare, only some options are used. See limitations.
}可以使用detektPlugins配置将detekt插件添加到您的项目中:
dependencies {
detektPlugins( " io.gitlab.arturbosch.detekt:detekt-formatting:<version> " )
}可以使用添加到KotlinCompile任务中的detekt扩展名来自定义报告。使用Groovy,这可能看起来像:
tasks . withType( org.jetbrains.kotlin.gradle.tasks.KotlinCompile ) . configureEach {
detekt {
reports {
xml . enabled . set( true )
txt . enabled . set( false )
create( " custom " ) {
enabled . set( false )
}
}
}
}我们的Gradle插件( DetektExtension )支持的所有内容,也支持此插件的声明端。
但是,只有以下选项被实施/传递给detekt: