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
Paul Dingemans
05/15/2024, 2:48 PM
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
Alex Arana
05/15/2024, 11:30 PM
You may want to try disabling
no-empty-first-line-in-class-body
p
Pavel Měsíček
05/16/2024, 6:47 AM
Thank you, blank-line-before-declaration is working