Tobias Bouschen created JDO-818:
-----------------------------------

             Summary: Use Google Java Style as the code format conventions for 
the JDO project
                 Key: JDO-818
                 URL: https://issues.apache.org/jira/browse/JDO-818
             Project: JDO
          Issue Type: Task
            Reporter: Tobias Bouschen


h4. Google Java Style

I would propose moving to Google Java Style 
([https://google.github.io/styleguide/javaguide.html]) as the code formatting 
style for the JDO project.

In my opinion, it offers a sensible and compact code style that is easy to 
read. An overview of the rules of this style is given in the link posted above.
h4. Google Java Format as the formatting tool

Additionally, I would propose moving to using the Google Java Format 
([https://github.com/google/google-java-format]) tool to do the formatting. It 
is an open source formatter provided by Google. It is available as a standalone 
JAR as well as plugin for IntelliJ and Eclipse (the Eclipse plugin might not be 
as well maintained as the IntelliJ plugin). As such, the code can be formatted 
using the CLI or the formatter can be integrated into the default formatting 
tools of IntelliJ/Eclipse.

One big point of contention of the Google Java Formatter plugin is that it 
offers very limited room for customization in order to ensure that it always 
results in a uniform code formatting for all users. This is also explained in 
the FAQ of the project: 
[https://github.com/google/google-java-format/wiki/FAQ#i-just-need-to-configure-it-a-bit-differently-how]
h4. Possible automated integration

As Google Java Format is available as a CLI tool, it can be used as part of the 
CI. For example, we could set up a Github Action that automatically checks the 
formatting of newly created code and report back if it does not match the 
Google Java Format style. It would also be possible to create a CI job that 
automatically formats checked-in code, but I am not a big fan of this approach 
as it changes code without any oversight, possibly leading to unwanted changes 
(e.g. if there is a bug in the formatter logic).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to