Is there a way to delegate IntelliJ formatter to k...
# arrow-contributors
s
Is there a way to delegate IntelliJ formatter to klint similar to scalafmt?
s
Thanks
a
apparently this should work
ktlint --apply-to-idea-project
s
It didn’t 😄
a
then you have Option #2, which is the manual option xD https://github.com/pinterest/ktlint#option-2
s
Ye going through it now
👍 1
m
Contrarian view. Given that JetBrains has published an official style guide, and IntelliJ supports it out of the box, wouldn’t it be better to follow that? Even if one may not like aspects of the style guide?
s
I think that entirely depends on a person and/or teams preference. It’s a guide, and we follow it closely but not entirely.
Klint actually helps us stay close to that with a compile time lint checker
Use 4 spaces for indentation. Do not use tabs.
This is the only place we differentiate
m
Obviously a contentious topic at the best of times. I see Kotlin a bit differently than other languages. Other languages have many team’s versions of a style guide available, whereas JB is attempting to set a standard. But of course you’re free to vary. tabs vs spaces is a never ending ‘war’, isn’t it? Personally, I’ve switched sides a few times, but generally I think we can agree that the most important thing is consistency on a team as opposed to any specific rule. Having style checking at compile time is definitely nice. My team tends to rely on IntelliJ’s commit dialog, and format on commit feature instead, and then in Code Review, rejecting if someone’s really messed up the formatting.