-
Notifications
You must be signed in to change notification settings - Fork 506
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
KtLint gives wrong autoCorrect flag to custom rule. #154
Comments
As experiment, I removed |
$ ktlint --version
0.15.0
$ cat A.kt
fun main(
args: String) {
println("")
}
$ ktlint -R com.github.MyDogTom:ktlint-custom-rules:master-SNAPSHOT A.kt -v
/tmp/A.kt:2:17: Parenthesis should be on new line (custom:class-and-function-header-format)
$ ktlint -R com.github.MyDogTom:ktlint-custom-rules:master-SNAPSHOT A.kt -F
<no output>
$ ktlint -R com.github.MyDogTom:ktlint-custom-rules:master-SNAPSHOT A.kt -v
<no output> Looks like everything is OK (at least in ktlint@0.15.0). |
Sure. fun main(args: String) {
println("")
}
|
Fix available in 0.15.1 (Maven Central sync might take up to 25 minutes). 🎈 |
Thank you for quick fix. I've checked new version via |
@MyDogTom thank you for letting me know. https://issues.sonatype.org/browse/OSSRH-37894 submitted. |
@MyDogTom it looks like Maven Central sync finally took place |
Thank you! |
Overview
My custom rule always receives
autoCorrect = false
, regardless that I'm callingemit
withcanBeAutocorrected = true
.Description
My custom rule is a copy of
IndentationRule
, but with enabled autocorrection. It means that both rules detect same error in same place.IndentationRule
emits error withcanBeAutocorrected = false
, myCustomIndentationRule
emits error withcanBeAutocorrected = true
How to reproduce.
I have repository which show case the problem. https://github.com/MyDogTom/ktlint-custom-rules/tree/fix-format (branch
fix-format
)It has intentional indent violation.
Auto correction works only when I remove
autoCorrect
check. See this commitFor sure, it somehow conflicts with standard
IndentionRule
, but it shouldn't. Unfortunately, I couldn't quickly figure out where is problem.The text was updated successfully, but these errors were encountered: