我希望我的项目对所有 kotlin 文件执行 ktlintCheck,但它只检查 build.gradle.kts 文件。build.gradle.kts 文件如下
ktlint {
version.set("9.4.0")
debug.set(true)
verbose.set(true)
android.set(false)
outputToConsole.set(true)
reporters {
reporter(ReporterType.PLAIN)
reporter(ReporterType.CHECKSTYLE)
}
ignoreFailures.set(false)
kotlinScriptAdditionalPaths {
include(fileTree("src/"))
}
filter {
exclude("**/generated/**")
include("**/kotlin/**")
}
}
subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
ktlint {
debug.set(true)
}
}
当我运行 gradlew ktlintCheck 时,终端输出如下:
gradlew ktlintCheck
> Task :ktlintKotlinScriptCheck
[DEBUG] Discovered ruleset with " standard" id.
[DEBUG] Discovered reporter with "checkstyle" id.
[DEBUG] Discovered reporter with "json" id.
[DEBUG] Discovered reporter with "html" id.
[DEBUG] Discovered reporter with "plain" id.
[DEBUG] Initializing "plain" reporter with {verbose=true, color=true, color_name=DARK_GRAY}
[DEBUG] Initializing "plain" reporter with {verbose=true, color=true, color_name=DARK_GRAY}, output=C:\Code\XXXX\build\reports\ktlint\ktlintKotlinScriptCheck\ktlintKotlinScriptCheck.txt
[DEBUG] Initializing "checkstyle" reporter with {verbose=true, color=true, color_name=DARK_GRAY}, output=C:\Code\XXXX\build\reports\ktlint\ktlintKotlinScriptCheck\ktlintKotlinScriptCheck.xml
[DEBUG] Checking C:\Code\XXXX\build.gradle.kts
Resolving .editorconfig files for C:\Code\XXXX\build.gradle.kts file path
[DEBUG] 809ms / 1 file(s) / 0 error(s)