Beginner question: by default why would ktlint spl...
# ktlint
p
Beginner question: by default why would ktlint split constructor arguments to multiple lines? Where can I find the mentioned class-signature rule? (how can I provide more detail to let others understand my setup?) thanks
p
Splitting constructor arguments on multiple line follows the same idea as splitting for functions. Please consult Klint documentation for question first.
p
I hoped there is a page where I can enter a violation id, like
standard:class-signature
and get a description for it, like for shellcheck: https://www.shellcheck.net/wiki/SC2062
I like short pages btw, but for violations, I cannot clearly see the path to follow. Or suppose I just joined a project using ktlint and get a violation. Well, ktlint can reformat it without question, maybe I'm just too curios for getting explanation and reasons behind the rules.
p
The project is almost 10 years old. For a lot of violations the rationale can be looked up in the Kotlin Coding Conventions, or in Android Kotlin Style guide. But they are just a starting point, and don't pretend to cover everything. On top of those, ktlint has its own conventions. For most of them there was a rationale when implementing, but information is scattered in issues, and code. Best advice I can give is just to accept one of the code styles, and of course I recommend the ktlint official style guide. It can be tempting to tweak the rules, or to disable rules that you don't like. But if you just give it some time to get adjusted to the coding style, you will receive the benefits of a more consistent code style, and hopefully less debates about formatting.
p
Fine, and I like formatting tools like that. I just would like to see the rationale under the hood. But understood, at that time no reasoning was written. I really like the bad and good example pairs, pro-cons, not for bikeshedding, just to learn the mindset.
👍 1
Oh, ok, I failed to find the page https://pinterest.github.io/ktlint/latest/rules/standard/ from ktlint page. 🤐 Note, when finding older page of https://pinterest.github.io/ktlint/1.7.1/rules/standard/ the top yellow bar saying
You're not viewing the latest version. *Click here to go to latest.*
from v1.7.1 redirects to main page, not the specific page, but at least I became aware, that there are such pages about the rules.
p
Ah good to know. Most likely, I messed up the documentation just yesterday.