facebook / ktfmt

A program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions.
https://facebook.github.io/ktfmt/
Apache License 2.0
907 stars 75 forks source link

Intellij Plugin set to Google (internal) always removes trailing commas #455

Closed mhernand40 closed 5 months ago

mhernand40 commented 5 months ago

My team just migrated from ktlint to ktfmt where we are leveraging the Gradle Plugin https://github.com/cortinico/ktfmt-gradle in CI. It is configured with the option googleStyle(). With the Gradle plugin, all trailing commas are left intact. However, when developers use the Intellij plugin to reformat the code, with the Code style set to Google (internal), the plugin seems to strip away all trailing commas.

The only way to keep the Gradle plugin's behavior consistent with the Intellij plugin's behavior is to use the default Code style for both. But then continuation indents require 4 spaces and we'd have to reformat our entire code base again.

mhernand40 commented 5 months ago

Closing this since it appears it was the ktfmt Gradle plugin that was not properly adhering to the Google Style.