I'm looking to implement a pre-commit automatic formatter for my team because the code is a bit all over the place. I like spotless and the google style but a sticking point seems to be 4-space indents, whereas it's currently outputting 2-space indents.
Is there a way to override this value via pom.xml, either on spotless side or the google side?
As instructed in Github issue comments here: https://github.com/diffplug/spotless/issues/420
You can solve this in Gradle build with:
indentWithTabs(2)
indentWithSpaces(4)
For Maven the same code would be:
<java>
<googleJavaFormat>
<version>1.8</version>
<style>GOOGLE</style>
</googleJavaFormat>
<indent>
<tabs>true</tabs>
<spacesPerTab>2</spacesPerTab>
</indent>
<indent>
<spaces>true</spaces>
<spacesPerTab>4</spacesPerTab>
</indent>
</java>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With