https://kotlinlang.org logo
#ktlint
Title
# ktlint
v

Vampire

12/05/2023, 12:40 PM
If you have a line comment in front of an annotation that describes the annotation like
Copy code
// work-around for <https://youtrack.jetbrains.com/issue/KT-38871>
// Kotlin 1.9+ and thus Gradle 8.3+ fixed it and no suppression is necessary anymore
@Suppress("UNUSED_VARIABLE")
val foo by gradle.extra {
    true
}
is it expected that ktlint adds a blank line between the comment and the annotation? Or can this be configured? Or would this warrant a bug report?
j

jw

12/05/2023, 4:20 PM
I use (attempting this on mobile slack so no promises...)
Copy code
@Suppress(
  // Explain
  "The thing",
)
Which lets me do multiple without changing the format or breaking the blame
v

Vampire

12/05/2023, 4:27 PM
Thanks, I'm aware of that work-around. Just want to know whether reporting it as issues would make sense or whether it would be closed anyway due to reasons like the other one I submitted. 🙂
At least I also don't see any rule in the official conventions that mandates a blank line before annotations.
w

wakingrufus

12/05/2023, 4:53 PM
maybe because it is not a multiline comment
Copy code
/* */
style
v

Vampire

12/05/2023, 4:59 PM
No, same for multi-line comment
s

Sha Sha Chu

12/05/2023, 5:33 PM
p

Paul Dingemans

12/05/2023, 6:49 PM
I see no reason that an EOL comment cannot proceed an annotation without a blank line. Can you file a bug for it?
v

Vampire

12/05/2023, 7:29 PM
Definitely, just wanted to avoid another right-away closed one. :-)
5 Views