db-scheduler icon indicating copy to clipboard operation
db-scheduler copied to clipboard

Use GoogleJavaFormat for code formatting

Open vivekkothari opened this issue 2 years ago • 1 comments

I know code formatting is very subjective, but is it possible to use GoogleJavaFormat to format the code in this repo? A lot of open source projects use the same formatter and its also easier to read.

vivekkothari avatar Jun 09 '22 13:06 vivekkothari

Good suggestion, I will think about it. I have seen PRs with variations in code-format

kagkarlsson avatar Jun 16 '22 05:06 kagkarlsson

If you are okay, I can raise a PR which formats entire codebase using GoogleJavaFormat.

vivekkothari avatar Mar 07 '23 15:03 vivekkothari

I had a look at it but was not convinced due to the short max-length of lines in the google-java-format.

What plugin do you recommend? Is there one with configurable max-length? (Say if I want 120)

kagkarlsson avatar Mar 08 '23 07:03 kagkarlsson

I did a trial run using spotless and the palantir code format, which is google-based with some tweaks. I tried google format which has 2 indents. I mostly liked it, but it some cases the indents were really hard to see..

kagkarlsson avatar Apr 20 '23 10:04 kagkarlsson

you can always customize the format and put in the repo in such a way that intellij like what armeria does. https://github.com/line/armeria/tree/main/settings/intellij_idea So that any new developer automatically get those settings.

vivekkothari avatar Apr 20 '23 14:04 vivekkothari

I am going to go with the google format. It just seem cleaner to me, and it was a better IntelliJ experience than the others.

kagkarlsson avatar Apr 26 '23 08:04 kagkarlsson

Merged to master via PR #375

kagkarlsson avatar Apr 26 '23 08:04 kagkarlsson