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

Class type parameters declaration (indentation) #180

Closed
badoualy opened this issue Mar 29, 2018 · 2 comments
Closed

Class type parameters declaration (indentation) #180

badoualy opened this issue Mar 29, 2018 · 2 comments

Comments

@badoualy
Copy link

badoualy commented Mar 29, 2018

I have the following class declaration

class BiAdapter<C : RecyclerView.ViewHolder, V1 : C, V2 : C, out A1, out A2>(
    val adapter1: A1,
    val adapter2: A2
) : RecyclerView.Adapter<C>()
    where A1 : RecyclerView.Adapter<V1>, A1 : ComposableAdapter.ViewTypeProvider,
          A2 : RecyclerView.Adapter<V2>, A2 : ComposableAdapter.ViewTypeProvider {

And I get an error while using klintCheck, because the last line has a 10 spaces indentation (to have A2 aligned with A1, and it's done automatically be Intellij

Not sure what is the recommended format in this case, this format feels the most natural, I guess

) : RecyclerView.Adapter<C>() where
A1 : RecyclerView.Adapter<V1>, A1 : ComposableAdapter.ViewTypeProvider,
A2 : RecyclerView.Adapter<V2>, A2 : ComposableAdapter.ViewTypeProvider {

would fix the error, but I'm not sure it's the recommended format.

I remember reading an issue in some github about code style for kotlin, where basically no one would agree on a standard format.

What's the recommendation for this in Klint?

Edit: for future references, the link I was mentioning Kotlin/kotlin-style-guide#2

@shyiko
Copy link
Collaborator

shyiko commented Mar 29, 2018

Hi @badoualy.
Thank for you the ticket.

It looks like vertical alignment is a way to go in this case (https://kotlinlang.org/docs/reference/generics.html#upper-bounds). I'll disable indent check inside where clause for now. We'll revisit it as part of (long-overdue) indent rule overhaul.

@shyiko
Copy link
Collaborator

shyiko commented Mar 29, 2018

Alright, 0.21.0 is out (Maven Central sync might take up to 25m (normally)).

@shyiko shyiko closed this as completed Mar 29, 2018
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

2 participants