Java source normalization (fixes #516) #631
Open
+87,352
−95,831
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have fixed the same problem today for the ODF Toolkit: tdf/odftoolkit#50
Using the Google Java Formatter:
https:/google/google-java-format
Capsulated by the following Maven plugin:
https:/Cosium/maven-git-code-format
adding a pre-commit-hook for checking the Java code.
You might reproduce the patch by:
mvn -X git-code-format:format-code -Dgcf.globPattern=**/*
There will be half a dozen problems with comments of unused imports within the Java imports, which breaks the formatting, but after the manual fixes, you will come to my patch.
NOTE: The ODF Toolkit is using in addition to the above Java formatter a whitespace formatter for the text files:
https://ec4j.github.io/editorconfig-maven-plugin/
See in https:/tdf/odftoolkit/blob/master/pom.xml#L257
and its configs:
https:/tdf/odftoolkit/blob/master/.editorconfig