pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.19k stars 505 forks source link

Feature: add another external config #2509

Closed xenoterracide closed 8 months ago

xenoterracide commented 8 months ago

I'd like to have a config like .ktlintrc.yml. I dislike abusing .editorconfig for "proprietary" (meaning properties not owned by editorconfig that couldn't be generic to everything/language/incubating). I'd be ok with a format like ini, properties, or toml too (I loathe json for human edited configs, but json5 is fine). Honestly, I wish we could all get on board with a convention for repo root configurations like <REPO>/.config/app/<config> (same structure as xdg but relative to repo). For now I've used the spotless gradle plugin just to encode my overrides in my buildSrc plugin.

paul-dingemans commented 8 months ago

Tnx for your suggestion. I am rejecting it for reasons below.

Having a separate configuration file would complicate Ktlint while it gives little benefits. It would still need to read .editorconfig for generic properties like indent_size, indent_style and max_line_length. User would need to maintain two different configuration files regarding ktlint.

The .editorconfig provides the posibility to define settings via 'globs'. To maintain that level of functionality the entire ec4j library which processes the .editorconfig would need to be copied in, adapted and maintained in the Ktlint project.

Lastly, this change will likely break the API for all Ktlint integrators. With introduction of Ktlint 1.x, it is promised that no breaking changes will be introduced during its 1.x lifetime. There are no plans to release a new major version.