Match ktlint_code_style with Ktlint documentation#2090
Match ktlint_code_style with Ktlint documentation#2090Jaehwa-Noh wants to merge 10 commits intodiffplug:mainfrom
Conversation
|
CHANGES.md
Outdated
| * Bump default `shfmt` version to latest `3.7.0` -> `3.8.0`. ([#2050](https://github.com/diffplug/spotless/pull/2050)) | ||
| * Bump default `ktlint` version to latest `1.1.1` -> `1.2.1`. ([#2057](https://github.com/diffplug/spotless/pull/2057)) | ||
| * Bump default `sortpom` version to latest `3.4.0` -> `3.4.1`. ([#2078](https://github.com/diffplug/spotless/pull/2078)) | ||
| * Default `ktlint` editorconfig `ktlint_code_style` to `intellij_idea` -> `ktlint_official`. ([#2090](https://github.com/diffplug/spotless/pull/2090)) |
There was a problem hiding this comment.
Maybe we can just note the default style intellij_idea in ktlint sections in docs, users can override them anyway in their configs.
There was a problem hiding this comment.
Yes, developer can override the style.
But the problem is that I introduced.
According Ktlint documentation, only one want to revert another code style must set the ktlint_code_style, but in Spotless need to set the ktlint_code_style who want to apply ktlint_official or else styles.
Unmatched default with ktlint documentation, makes developer mistake and misconception.
There was a problem hiding this comment.
That's the ktlint CLI's default value instead of this plugin.
Did you see the context above? This change will break users' compatibility, it's so painful and annoying.
There was a problem hiding this comment.
No, I don't think that break users' compatibility.
This ktlint_official is ktlint's default value, and spotless loads ktlint plugin, so that there's no reason doesn't follow ktlint official documentation.
See below snippet
spotless {
kotlin {
ktlint()
}
}You say that spotless will apply intellij_idea style ktlint.
But the one who read ktlint documentation, will say that spotless will apply ktlint_official style ktlint.
This inconsistent situation will bring more fatigue to developer. Every developers must double check both spotless documentation and ktlint documentation what is different.
It is non-sense.
|
I add the instruction in |
- If don't have ktlint_code_style, ```ktlint``` set it ```ktlint_official``` as default value.
- writePomWithKotlinSteps_intellijIdea_intellijIdeaStyleKtlint - writePomWithKotlinSteps_default_officialStyleKtlint
- target_setAndUnset_intellijIdeaStyle - target_setAndUnset_defaultKtlintOfficialStyle
- editorConfigOverride_setExperimental_intellijIdeaStyle - editorConfigOverride_setExperimental_defaultKtlintOfficialStyle
|
Okay, I got it. |
Ktlint document says that
But Spotless default set
intellij_ideaIt makes developer mistake and misconception.According Ktlint documentation, only one want to revert another code style must set the ktlint_code_style, but in Spotless need to set the ktlint_code_style who want to apply
ktlint_officialorelsestyles.