You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should be allowed to write multiple annotations on separate lines which are followed by comments. As example:
@Suppress("AnnotationRule") // some comment
@Suppress("AnnotationRule")
@Suppress("AnnotationRule")
class FooBar1
Or for kotlin script:
@file:Suppress("AnnotationRule") // some comment
@file:DependsOn("ktlint")
@file:DependsOn("ktlint")
Observed Behavior
The AnnotationRule is showing the following error: Annotations with parameters should all be placed on separate lines prior to the annotated construct
Steps to Reproduce
The following test should show the problem:
@Test
fun`Given multiple annotations with a parameter followed by a EOL comment`() {
val code =""" @Suppress("AnnotationRule") // some comment @Suppress("AnnotationRule") @Suppress("AnnotationRule") class FooBar1""".trimIndent()
annotationRuleAssertThat(code).hasNoLintViolations()
}
Your Environment
Version of ktlint used: 0.46.1
The text was updated successfully, but these errors were encountered:
Replace (biggest part of) processing of MODIFIER_LIST and FILE_ANNOTATION_LIST with processing of
individual ANNOTATION_ENTRY. This allows ANNOTATION_ENTRY to be followed by EOL_COMMENT plus
another ANNOTATION_ENTRY.
Reword the violations to be more clear.
Annotation with parameter(s) on same line as annotated construct is rewritten to
annotation on a separate line directly as otherwise a lint violation would remain
after the first format.
Closespinterest#1539
* Refactor AnnotationRule to improve maintainability
Replace (biggest part of) processing of MODIFIER_LIST and FILE_ANNOTATION_LIST with processing of
individual ANNOTATION_ENTRY. This allows ANNOTATION_ENTRY to be followed by EOL_COMMENT plus
another ANNOTATION_ENTRY.
Reword the violations to be more clear.
Annotation with parameter(s) on same line as annotated construct is rewritten to
annotation on a separate line directly as otherwise a lint violation would remain
after the first format.
Closes#1539
Expected Behavior
We should be allowed to write multiple annotations on separate lines which are followed by comments. As example:
Or for kotlin script:
Observed Behavior
The AnnotationRule is showing the following error:
Annotations with parameters should all be placed on separate lines prior to the annotated construct
Steps to Reproduce
The following test should show the problem:
Your Environment
The text was updated successfully, but these errors were encountered: