Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support lint and formatting of annotations #258

Closed
jaredsburrows opened this issue Jul 25, 2018 · 4 comments
Closed

Support lint and formatting of annotations #258

jaredsburrows opened this issue Jul 25, 2018 · 4 comments

Comments

@jaredsburrows
Copy link
Contributor

Description:

  • ktlint should find annotations with no arguments not on the same line
  • ktformat should format them by putting them on the new line

References:

@AleksandrSl
Copy link
Contributor

@jaredsburrows, @shyiko
Based on https://android.github.io/kotlin-guides/style.html#annotations
https://kotlinlang.org/docs/reference/coding-conventions.html#annotation-formatting
there is only one rule. Annotations with arguments must be on separate lines and even this is not enforced:

Annotations are typically placed on separate lines

@cable729
Copy link
Contributor

@AleksandrSl I read it a little differently, as in the quote you posted is an general rule that serves as an intro to the section, and the following rules describe exactly when they should be placed on separate lines. I.e. the following is valid:

@JvmField var disposable: Disposable? = null
@JvmField @Volatile
var disposable: Disposable? = null
@MyAnnotation("asdf")
var disposable: Disposable? = null

But this is not:

@JvmField @Volatile var disposable: Disposable? = null
@MyAnnotation("asdf") var disposable: Disposable? = null

@cable729
Copy link
Contributor

Anyone else working on this? Mind if I take this one?

@shyiko
Copy link
Collaborator

shyiko commented Oct 24, 2018

@cable729 that would be great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants