Skip to content
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

Move to Google Java Formatter #6046

Closed
boc-tothefuture opened this issue Sep 8, 2019 · 4 comments
Closed

Move to Google Java Formatter #6046

boc-tothefuture opened this issue Sep 8, 2019 · 4 comments

Comments

@boc-tothefuture
Copy link
Contributor

boc-tothefuture commented Sep 8, 2019

One of the benefits of moving to maven/bnd is that developers are now free to use whatever IDE they feel most productive in. For some, that is not eclipse.

Historically, to ensure consistent code formatting eclipse code formatter settings were shipped with the official IDE. While that worked well when we were locked into a single IDE, I don't believe that will continue to work well in a multi-IDE universe.

I propose that we move to the Google Java Formatter which enforces the Google Java Style for the following reasons:

  • Uniform formatting across popular IDEs. Plugins available for IntelliJ and Eclipse. Can run as a task in VS Code
  • Can run as a git commit hook
  • Both Maven and Gradle plugins exist
  • CI/CD friendly
  • Popular specified format with no options which prevents bikeshedding. It is much more important to have a standardized format than "the best format".

Issues/Discussion topics:

  • If we go this route, should it be done in bulk as a single commit, enforce it over time on new commits, or just enforce it for new plugins. If we do it in bulk, it is yet another large change. If we enforce it with new commits, there will be a lot of noise.
  • Another option is to try and mimic the current format across multiple IDEs which has the drawbacks of needing to create/maintain three sets of standards that may or may not have the exact same style options. This also doesn't help the vim/emacs/notepad/whatever crowd.
  • Who has to agree to this change. @kaikreuzer anyone else?
  • If we go this route, need to figure out if it makes sense to put it in the CI/CD (fail the build?), git commit hook, maven or some other route.
@J-N-K
Copy link
Member

J-N-K commented Sep 9, 2019

I like the idea. Just importing the Eclipse settings in IntelliJ does not produce the correct codestyle.

IMO the maven plugin applied once should reformat all existing code and it should be added as one commit. SAT needs to be adapted, too.

@boc-tothefuture
Copy link
Contributor Author

@J-N-K what needs to happen with SAT?

@kaikreuzer
Copy link
Member

Sounds pretty conflicting with openhab/openhab-core#935.

Before changing the format of ALL our code, I'd very much prefer to get at least one IDE setup fully working and documented, so that people are able to work without interruption...

@boc-tothefuture
Copy link
Contributor Author

Agree on both counts. That is probably the better path forward as it would not be yet another large change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants