Closed bdalenoord closed 4 days ago
@Suppress("UnnecessaryAbstractClass") // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa abstract class Seven(val one: String, val two: String)
It looks like that the annotation @Suppress("UnnecessaryAbstractClass")
is ignored from the class signature. But the EOL comment after the annotation is not ignored. The total length of that EOL comment and the actual class signature abstract class Seven(val one: String, val two: String)
together do exceed the 120 character limit.
Of course the comment on a previous line should be ignored when deciding whether the line limit is exceeded.
Expected Behavior
I've configured ktlint with Spotless:
(the spotless version is 6.25.0 and I'm using the Gradle-plugin)
As you can see, I've configured the
signature_rule_force_multiline_when_parameter_count_greater_or_equal_than
tounset
for both class signatures as well as function signature.I expect class signatures that don't exceed my max. line length of 120 to not be multilined.
An example:
Observed Behavior
After running
spotlessKotlinApply
on the class above, the output is as follows:I don't understand why a previous line would cause my class
Seven
to be wrapped... Especially as classesFive
andSix
, which has the same signature, are left untouched (the one additional character for classSeven
causes the behavior).Steps to Reproduce
Create a file containing the six unformatted classes. Run
spotlessKotlinApply
and observe that classSix
is multilined.Your Environment
.editorconfig
settings./gradlew spotlessKotlinApply
Build time: 2024-02-02 16:47:16 UTC Revision: d55c486870a0dc6f6278f53d21381396d0741c6e
Kotlin: 1.9.20 Groovy: 3.0.17 Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023 JVM: 21.0.2 (Eclipse Adoptium 21.0.2+13-LTS) OS: Linux 6.5.0-44-generic amd64