We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
@receiver annotations with parameters should not be required to be on a different line.
@receiver
When annotating with @receiver:SomeAnnotation(SomeParameter), the AnnotationRule fails with the following:
@receiver:SomeAnnotation(SomeParameter)
AnnotationRule
Annotations with parameters should all be placed on separate lines prior to the annotated construct
Drop this in a Kotlin file and run ktlint on it:
interface AnnotationExample { fun @receiver:ExampleAnnotation("Breaks Ktlint") ExampleClass.provideExample(): ExampleInterface } interface ExampleInterface class ExampleClass : ExampleInterface annotation class ExampleAnnotation(val arg: String)
You can successfully meet the criteria with the following:
fun @receiver:ExampleAnnotation("Breaks Ktlint") ExampleClass.provideExample(): ExampleInterface
However this is quite unexpected as a reader, and feels inconsistent when parameter-free annotations work just fine:
fun @receiver:ExampleAnnotation ExampleClass.provideExample(): ExampleInterface
./gradlew ktlint --version ------------------------------------------------------------ Gradle 6.6.1 ------------------------------------------------------------ Build time: 2020-08-25 16:29:12 UTC Revision: f2d1fb54a951d8b11d25748e4711bec8d128d7e3 Kotlin: 1.3.72 Groovy: 2.5.12 Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020 JVM: 1.8.0_242-release (JetBrains s.r.o 25.242-b3-6222593) OS: Mac OS X 10.15.6 x86_64
The text was updated successfully, but these errors were encountered:
Thanks for reporting! We'll take a look. And the version of ktlint is 0.37.2 I assume (it seems you've missed to add it to the report)?
Sorry, something went wrong.
We're on 0.38.1
Successfully merging a pull request may close this issue.
Expected Behavior
@receiver
annotations with parameters should not be required to be on a different line.Observed Behavior
When annotating with
@receiver:SomeAnnotation(SomeParameter)
, theAnnotationRule
fails with the following:Steps to Reproduce
Drop this in a Kotlin file and run ktlint on it:
You can successfully meet the criteria with the following:
However this is quite unexpected as a reader, and feels inconsistent when parameter-free annotations work just fine:
Your Environment
The text was updated successfully, but these errors were encountered: