Feat: Use JBang-fmt to format sources#1945
Conversation
This can be easily incorporated into git commit hooks as well. See https://github.com/jbangdev/jbang-fmt This is "bare minimum" setup, to format only main and test Java sources of server (excluding jOOQ generated ones). Once we format, initial formatting will need a "source format" commit without any other code change, and add that commit hash to `.git-blame-ignore-revs` file in repo root to fix blame.
|
I did update the used format to a custom eclipse format with some modifications that I would prefer. I am not happy with the array initializers. The closing bracket is not on a new line when wrapping, but that does not seem to be supported by the eclipse format. Either always have the closing bracket or not, there is no option to conditionally add it to a new line depending on whether it was wrapped. There are a few occurrences in the code I do not really like but it looks like 99% of the other cases are fine. wdyt @cstamas @gnugomez @autumnfound ? you can just run |
|
this format is as close as possible to the existing formatting that is currently used afaict. |
|
I like it! And make it applied as soon as possible! |
|
I also added an sort import step using spotless which is run via jbang as the eclipse formatter does not support that unfortunately. as there is no cli, claude came up with a small java file to run the ImportOrder step on all the source files that can be executed with jbang. pretty neat imho. I pefer the following order: |
|
btw. created eclipse-jdt/eclipse.jdt.core#5195 for the issue in the eclipse formatter that it can not place the closing brace of an array initializer on a new line if its wraps. |
This can be easily incorporated into git commit hooks as well.
See https://github.com/jbangdev/jbang-fmt
This is "bare minimum" setup, to format only main and test Java sources of server (excluding jOOQ generated ones).
Once we format, initial formatting will need a "source format" commit without any other code change, and add that commit hash to
.git-blame-ignore-revsfile in repo root to fix blame.Git integration doco:
https://github.com/jbangdev/jbang-fmt#git-integration