Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add google-java-format formatter #712

Closed
3 of 5 tasks
Tracked by #717
tschaffter opened this issue Sep 17, 2022 · 1 comment · Fixed by #713
Closed
3 of 5 tasks
Tracked by #717

Add google-java-format formatter #712

tschaffter opened this issue Sep 17, 2022 · 1 comment · Fixed by #713
Assignees
Labels
dev/env formatting Source formatter issues java

Comments

@tschaffter
Copy link
Member

tschaffter commented Sep 17, 2022

We are currently using the Java formatter provided by the VS Code extension Language Support for Java(TM) by Red Hat. VS Code is configured to format Java files when saving using the configuration file eclipse-java-google-style.xml.

There are two issues with this approach:

  • Google is moving away from eclipse-java-google-style.xml, which has not been updated in years (see this post).
  • The files generated by the OpenAPI generator should be formatted similarly to the non-generated files. The only viable approach is to run the formatter programmatically, which is not possible using the extension Language Support for Java(TM) by Red Hat.

Tasks:

  • Remove the file eclipse-java-google-style.xml from the workspace folder.
  • Add google-java-format as an npm dependency.
  • Configure VS Code to use google-java-format when saving Java files (see instructions).
  • Document the formatter in docs/linters-and-formatters.md.

Future tasks:

  • Check that Java files are properly formatted in Git hook and CI workflow
@tschaffter
Copy link
Member Author

Added to Sprint 22.09

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
dev/env formatting Source formatter issues java
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant