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

Ktlint formatting is incosistent with what is reporting #877

Closed
PPetka opened this issue Aug 31, 2020 · 2 comments · Fixed by #1021
Closed

Ktlint formatting is incosistent with what is reporting #877

PPetka opened this issue Aug 31, 2020 · 2 comments · Fixed by #1021

Comments

@PPetka
Copy link

PPetka commented Aug 31, 2020

This one feels critical to me and, and I guess should be hotfixed
Fixing this one might introduce this issue.

I am having file that according to AS is formatted OK.

object Someclass : List<Shortcut> by listOf(
    Shortcut(
        id = "1",
        url = "url"
    ),
    Shortcut(
        id = "2",
        url = "asd"
    ),
    Shortcut(
        id = "3",
        name = "TV"
    )
)

Ktlint found error:
Unexpected indentation (expected 0, actual 4)
And formatted this like:

object SomeClass : List<Shortcut> by listOf(
        Shortcut(
            id = "1",
            name = "Sport"
        ),
        Shortcut(
            id = "2",
            name = "Nöje"
        ),
        Shortcut(
            id = "3",
            name = "TV"
        )
    )

After I run ktlint again I am getting error
Unexpected indentation (expected 4, actual 8)

So even ktlint made formatting, it still reports error.
Its now arguing with itself

version 0.38.1

@romtsn
Copy link
Collaborator

romtsn commented Aug 31, 2020

It's actually parameter-list-wrapping, you can try to disable it for this block for now

@cowst
Copy link

cowst commented Sep 30, 2020

It's actually parameter-list-wrapping, you can try to disable it for this block for now

Nope, I have the same issue and only disabling the (now experimental) argument-list-wrapping I get no errors.
So it has been tagged correctly :)

romtsn added a commit to romtsn/ktlint that referenced this issue Dec 18, 2020
romtsn added a commit that referenced this issue Dec 18, 2020
romtsn added a commit to paul-dingemans/ktlint that referenced this issue Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants