Hi, does anybody know, which rule is responsible f...
# ktlint
p
Hi, does anybody know, which rule is responsible for adding empty lines in classes, interfaces etc. please? For example:
Copy code
interface Actions {
    fun onBack()

    fun onAppTheme(applicationTheme: ApplicationTheme)

    fun onToggleBiometrics(value: Boolean)
}
I would like to disable it
p
Running Ktlint CLI or ktlint-intellij-plugin are two great ways to discover the rule which causes the violation. I am not sure whether the lint action of the Gradle plugin reveals it as well. With Ktlint CLI you can find this as follows:
Copy code
$ ktlint-1.2.1 --stdin
16:48:19.718 [main] INFO com.pinterest.ktlint.cli.internal.KtlintCommandLine -- Enable default patterns [**/*.kt, **/*.kts]
interface Actions {
    fun onBack()
    fun onAppTheme(applicationTheme: ApplicationTheme)
    fun onToggleBiometrics(value: Boolean)
}
<stdin>:3:5: Expected a blank line for this declaration (standard:blank-line-before-declaration)
<stdin>:4:5: Expected a blank line for this declaration (standard:blank-line-before-declaration)

Summary error count (descending) by rule:
  standard:blank-line-before-declaration: 2
1
a
You may want to try disabling
no-empty-first-line-in-class-body
p
Thank you, blank-line-before-declaration is working
106 Views