-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ci for coding style #2
Conversation
In order to work one must crete a file `./.env` that defines `GOOGLE_JAVA_FORMATTER_JAR` as environment variable pointing to the location of the google-java-formatter jar file. Example `./.env` ``` GOOGLE_JAVA_FORMATTER_JAR="/usr/local/Cellar/google-java-format/1.10.0/libexec/google-java-format.jar" ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine.
I've merge 'main' into this PR to enable it to be fast-forward mergeable to main, when dissolved.
Also, I've added a format.sh
script which calls google-java-formatter locally for when one would like for format upfront.
Just checked the result of the formatter GitHub action: |
Co-authored-by: github-actions[bot] <action@github.com>
@herrmanno looks good, I fixed the ci for Java 16. |
bin/format.sh
Outdated
@@ -14,6 +14,4 @@ java --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ | |||
retVal=$? | |||
if [ $retVal -ne 0 ]; then | |||
echo "[ERROR]: Some files needed formatting" | |||
exit $retVal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary for the Github Action? Otherwise, a non-zero return value may be useful when the format script is used as (pre-commit) git hook to prevent committing code that does not satisfy the format rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re added in #4
This pr adds a github action for automating coding style fixes using google-java-format. The goal is to keep future pull requests clean and make them easier to review.