-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Questions about IndentionRule #233
Comments
I updated description with two additional questions. @shyiko Let me know if you prefer separate issues instead. |
Hey @MyDogTom. Welcome back!
I had to go with an alternative implementation (ParameterListWrappingRule) as I was getting a bunch of issues with that rule. Original ClassAndFunctionHeaderFormatRule is still available in the develop branch.
Absolutely. It's one of the most requested features.
$ printf "val a =\n b\n .c()\n" | ktlint --stdin
<text>:2:1: Unexpected indentation (1) (it should be 4)
<text>:3:1: Unexpected indentation (2) (it should be 5)
$ printf "val a =\n b\n .c()\n" | ktlint --stdin
<text>:2:1: Unexpected indentation (1) (it should be 4)
<text>:3:1: Unexpected indentation (4) (it should be 5) In short, if the previous line is miss-aligned the "expected" indentation value is not calculated properly. There multiple ways to fix this, the best being rewrite IndentationRule to calculate/auto-correct everything in one pass.
I agree. Let's avoid any "continuation indent" logic if we can help it. |
#137 contains
That's why, in first PR I displayed error with relative indent and not with absolute (see commit]. Afterwards, it was changed to absolute. I'll create a separate ticket with my proposal about error message.
During my tests, I've found at least one case when "continuation indent" should be used. I'll create a separate ticket to discuss it. @shyiko thanks, for your answer. I'm closing it, since further discussion will be in separate issues (to make it more focused). |
Hi @shyiko . I finally have some time and would like to proceed with #141 . I didn't follow the project since
0.15.1
. I have some questions.Question 1.
While refreshing my memory, I noticed that
IntentRule
doesn't support auto correction anymore. Auto correction was merged into master as part of #137 , but now I cannot find any traces of that change. Any reason for that? Do you see auto correction for IndentRule as welcomed change?Question 2
There is a
TODO
inIndentationRule
Could you elaborate a bit what is wrong with that?
Question 3
Android style guide has definition for "continuation indent", but doesn't have any cases when to use it. Kotlin coding conventions doesn't even have definition of "continuation indent".
IndentionRule
uses "greater common divider" when choose indent size. Basically, it means that regular indent will be always selected.I would make it easier and always use "regular indent". Unless specific case, when exactly "continuation indent" should be used, pops up. What do you think?
The text was updated successfully, but these errors were encountered: