For constructor param indentation when each is on ...
# codingconventions
k
For constructor param indentation when each is on a separate line, is it supposed to be 4 or 8? Android studio defaults to 8 but ktlint flags it as 4...
m
In IDEA, there’s an option in code style to set it to the Kotlin Style guide. The IntelliJ default isn’t quite the same (or perhaps in latest updates, they’ve made it match). So as part of developer setup, everyone is told to update their code style to Kotlin style guide. Once you choose Kotlin in Code Style, does Android studio have a
Set from...
option in top-right? If so, hopefully there’s a
predefined styles
option and the Kotlin style guide is there. If you can convince the whole team to update, you can then have everyone use reformat code in the IDE, and turn that option on in the commit dialog. Reduces the number of diffs that are whitespace/formatting only
k
we do have a team android studio config...I modified it there 🙂
m
In intellij, the ide also has the kotlin published conventions predefined as a code style and you can reset the current to be that. So no need for a separately maintained config. But sounds like you have it under control
k
Yep...we've got other tweaks... Thanks
b
The kotlin style guide says
Use regular indent (4 spaces) for constructor parameters.