Sample project to reproduce detekt indentation issue
Looks like continuationIndentSize isn't taken into account by detekt
Steps to reproduce:
- Verify the kotlin file is formatted properly according to Android Studio
- Open the project in Android Studio
- Open the
Hello.ktfile - Do Code -> Reformat code
- Note, nothing changes
- Run detekt
./gradlew detekt- Expected behavior: no issues are found
- Actual behavior: two
Indentationissues are found ("Unexpected indentation (16) (should be 12)")
Experiment with:
continuationIndentSize: Try setting this parameter, inconfig/detekt.ymlto8or4- The result is the same
- Android Studio: Verify default formatting:
- Preferences -> Editor -> Code Style -> Kotlin -> Set from -> "Kotlin style guide"
- A code reformat doesn't change anything (it was already formatted with this style guide)
- Android Studio: Customize formatting:
- Preferences -> Editor -> Code Style -> Kotlin -> Tabs and Indents -> Continuation Indent: Put
4instead of8 - Now detekt passes, regardless of whether its
continuationIndentSizeis set to4or8
- Preferences -> Editor -> Code Style -> Kotlin -> Tabs and Indents -> Continuation Indent: Put