-
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
ktlintFormat does not autoformat #129
Comments
@vanniktech ktlint@0.14.0 --format reports errors which it cannot fix automatically. As of 0.14.0 this includes |
Oh it's indent. Do we have an issue to autofix these? |
@shyiko I cannot make it even report indenting errors - it just ignores wrong indentation. Other types of errors (max line length, wildcard imports etc) are detected. |
And when do you plan to implement autoformatting in ktlint? |
@KolesnichenkoDS a week after the New Year Eve. |
@shyiko cool! |
Is indenting on autoformat working now? It's just getting reported when I tried it. |
@dannyroa partially: parameter list wrapping auto-correction included in 0.16.0+; general indentation is in the works. |
@shyiko: Any way I can help build this feature? Thanks. |
@dannyroa That would be great! @MyDogTom made a good progress in #137 (changes are in develop branch) but it needs more work; fun a() {
class A() {
val a = 1
}
} I feel like instead of calculating previous indent on each visit(...) we should iterate through AST once (on FILE) and report/correct wrong indents as we go (based on the nesting so far). (current rule sources are here - https://github.com/shyiko/ktlint/blob/master/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/IndentationRule.kt) P.S. You might find https://github.com/shyiko/ktlint#ast helpful. |
@shyiko Code you mentioned is not formatted, because rule is not strict enough. Violation is just not detected. I've explained it in details here. It's not related to the calculation of previous intent. Rule just should be more strict. |
@MyDogTom #141 (comment) << right. |
When I apply this section into my
app/build.gradle
file:and I'm running it via
./gradlew ktlintFormat
I'd expect to get auto corrected files. The only thing I'm seeing in the console is that the warnings are reported but nothing gets fixed. Is there any flag missing for the executable?I'm using 0.14.0
The text was updated successfully, but these errors were encountered: