小编KY *_*Lau的帖子

ktlint 不检查 kotlin 文件

我希望我的项目对所有 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)
    }
}
Run Code Online (Sandbox Code Playgroud)

当我运行 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. …
Run Code Online (Sandbox Code Playgroud)

kotlin gradle-kotlin-dsl ktlint

4
推荐指数
1
解决办法
4968
查看次数

标签 统计

gradle-kotlin-dsl ×1

kotlin ×1

ktlint ×1