Skip to content

Align configuration options between CLI, IDE plugin and Gradle #567

@vRallev

Description

@vRallev

I'm fully aware of the decision to provide as few configuration options as possible. I'm also aware of #470 providing a CLI option to change the line length. However, over a year later these decisions have a few bad consequences and I hope the decision will be reconsidered.

The IDE and Gradle plugin both provide the option to change the line length, block indent, continuation indent, trailing comma management and removing unused imports. Through CLI you can only change the unused import option. This inconsistency is a downside as projects started to make use of these options when only formatting through Gradle or the IDE.

In #470 the recommendation was to create wrapper for CLI that provides all these options. Because of this decision, projects like these are born https://github.com/block/kotlin-formatter/ It's basically a ktfmt wrapper only to change the line length. But with a separate CLI binary, there is the valid desire to run all formatting through the same binary, therefore the IDE and Gradle plugin have to be forked. I think this is worse than providing consistent configuration options through all tools.

Another perspective to look at this concern is that code style options are limited to Meta, Google and Kotlin-Lang. Why not allow a company like Block to define their code style for these few options? Allow defining custom options like --block-style.

These configurations could be passed in through CLI in multiple ways. Using an .editorconfig as suggested in #45 is another approach.

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