Skip to content
New issue

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

Trailing comma in function literal is incorrectly formatted and results in false positive at next invocation #1911

Closed
paul-dingemans opened this issue Apr 2, 2023 · 0 comments · Fixed by #1912

Comments

@paul-dingemans
Copy link
Collaborator

Given code below and that trailing comma's on declaration site are enabled:

val foo = {
        string: String,
        int: Int ->
    // do something
}

then this code is formatted as:

val foo = {
        string: String,
        int: Int, ->
    // do something
}

and on the next invocation of ktlint, it reports violation below:

Whitespace after ',' is missing (experimental:parameter-list-spacing)

On the first invocation, the code should be formatted as:

val foo = {
        string: String,
        int: Int,
    ->
    // do something
}

and no violation may be reported on following invocations

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant