Skip to content

The trailing comma experimental rule does not working properly #1297

@mohsenoid

Description

@mohsenoid

The trailing comma experimental rule is not working properly for this file:

https://github.com/mohsenoid/Rick-and-Morty/blob/c9fb8dc093c7986055e8892b8e126f60bf0247cc/app/src/main/kotlin/com/mohsenoid/rickandmorty/data/db/DbRickAndMorty.kt#L51

Android Studio works correctly and adds a comma, but Ktlint doesn't and even removes the comma added by Android Studio!

Expected Behavior

Add a comma and do not remove the one from the Android Studio code styler

Observed Behavior

Do not add a comma and also remove the one from the Android Studio code styler

Steps to Reproduce

Take this file and enable both these rules in .editorconfig

ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true

execute this command:

ktlint -F --experimental "app/src/**/*.kt"

Your Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions