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: