我想尝试Kotlin和ktlint,我很高兴看到它通过editorconfig文件支持制表符缩进(因为
此PR
)。不幸的是,它似乎对我不起作用。我以前没有用过editorconfig,我可能犯了一些简单的错误。
我的
在根文件夹中:
indent_style = tab我的gradle文件:
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val koinVersion: String by project
val junitVersion: String by project
plugins {
application
kotlin("jvm") version "1.4.30"
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
}
group = "me.me"
version = "1.0-SNAPSHOT"
application {
mainClassName = "de.me.bot.translate.MainKt"
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation("com.sksamuel.hoplite:hoplite-core:+")
implementation("org.koin:koin-core:$koinVersion")
testImplementation("org.koin:koin-test:$koinVersion")
testImplementation(kotlin("test-junit5"))
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
}
tasks.test {
useJUnitPlatform()
}
tasks.withType() {
kotlinOptions.jvmTarget = "13"
}但是,由于意外的制表符,运行gradle ktlintCheck仍然会抛出异常。我不明白为什么。我用--debug运行它,但它没有给我任何有用的信息。
这是我的项目: github.com
发布于 2021-03-01 22:33:54
EditorConfig规范
州
除根密钥外,所有对都必须位于一个节下才能生效。
所以你的.editorconfig文件应该是:
root = true
[*.{kt,kts}]
indent_style = tabhttps://stackoverflow.com/questions/66415191
复制相似问题