https://kotlinlang.org logo
#ktlint
Title
# ktlint
j

Jonathan Lennox

09/28/2023, 7:11 PM
Also, is there documentation somewhere about what the substantive differences are between the various values of
ktlint_code_style
?
p

Paul Dingemans

09/28/2023, 7:38 PM
The name of the rule is not entirely accurate. There is no documentation with substantive differences. It is hard to maintain. Most innovations are to be expected in the ktlint_official code style. The other code styles are more intended for users that adapted ktlint in the past and do not (yet) want to migrate to the new code style.
e

eygraber

09/28/2023, 11:04 PM
Most innovations are to be expected in the ktlint_official code style
That's really unfortunate 😕
p

Paul Dingemans

09/29/2023, 11:29 AM
It depends. New rules that are exposed by default in the
ktlint_official
code style can still be enabled in the other code styles as well. Whenever a new rule is applicable in all code styles, it will just be exposed as a normal rule. Same for bugfixes. Formatting which does not comply with IntelliJ IDEA default formatter, will be exposed in
ktlint_official
only. This is used in case the other code styles follow inferior IntelliJ IDEA formatting due to bugs in the formatter. Or, when from a consistency viewpoint, a different format is preferred. Also, the
ktlint_official
code style contains formatting rules that go beyond what is defined in the Kotlin coding conventions and Androids Kotlin styleguide. The old code styles will not be removed, nor deprecated in the foreseeable future.
e

eygraber

09/29/2023, 12:25 PM
Also, the
ktlint_official
code style contains formatting rules that go beyond what is defined in the Kotlin coding conventions and Androids Kotlin styleguide
😅 https://xkcd.com/927/
inferior Intellij IDEA formatting
I find it a little hypocritical that you're using that kind of language after insisting that users don't criticize your decisions in ktlint. There are some bugs in the Intellij formatter, but nothing crazy. I know it's difficult for you because you support the proper spec when they don't, but I think they've publicly said that they're not working on it so much due to a lack of resources.
p

Paul Dingemans

09/29/2023, 12:56 PM
Ok, you read
inferior
differently than I meant. IntelliJ IDEA formatting is very good although it has way to many exceptions which result in inconsistent formatting. What I really meant was that there are multiple bugs in IntelliJ IDEA formatting which are still not solved are being open for several years. What is most disturbing, that there is almost no response on those bugs.
e

eygraber

09/29/2023, 1:36 PM
I understood, but was making a point that you could afford the same leniency to those who use similar language in the ktlint repo 😅 I personally think that because of the inconsistency a certain level of customization is warranted that goes beyond the code styles. I happen to like the level of customization that detekt offers with their rules; it allows a lot of these rough edges to be smoothed out in a way that works per project, and doesn't feel like it's bikeshedded.
3 Views