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

Code formatting #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Code formatting #18

wants to merge 2 commits into from

Conversation

jjzazuet
Copy link
Contributor

@jjzazuet jjzazuet commented Oct 5, 2020

Applies automatic Google Java code formatting conventions to the full source tree.

Not a lot of difference with current formatting except:

  • Indentation size.
  • Order of a few imports.
  • Class header javadoc comments.

Thanks!

@jjzazuet jjzazuet requested a review from simonwep October 5, 2020 23:04
@jjzazuet
Copy link
Contributor Author

jjzazuet commented Oct 5, 2020

By including the Google Java format plugin, code check-ins which violate formatting will fail the build.

To apply automatic formatting use:

gradle googleJavaFormat

@jjzazuet
Copy link
Contributor Author

jjzazuet commented Oct 8, 2020

@simonwep , are we clear to merge and keep going? Thanks.

@simonwep
Copy link
Owner

simonwep commented Oct 8, 2020

Sorry for the late response, yes this looks really good! Didn't know that there plugins for Java to format code and stuff 😊 (I always used the IDE)

Only one thing - I'd actually prefer 4 spaces instead of 2 (regarding overall readability), or what do you think?

@jjzazuet
Copy link
Contributor Author

jjzazuet commented Nov 9, 2020

@simonwep my apologies, as I just wrapped up a large project at work taking most of my time. Two space base indentation is generally recommended by Google's Java code style formatting conventions. A lot of projects follow it since it offers good readability in most IDEs.

https://google.github.io/styleguide/javaguide.html

Let me know if you'd prefer to keep it on 4 spaces and I'll close this PR. Thanks!

@simonwep
Copy link
Owner

Hey, I totally understand and I'm grateful what you've already done!
I'd actually stick to 4 spaces for readability and consistency, but I'm interested in googles code formatter - would it be possible to configure it using 4 spaces? Tabs would also work as we don't need to align any properties like in JSX, but in case of large code-blocks it's hard to distinguish 10 different levels of indentation.

@lukeeey
Copy link

lukeeey commented Nov 13, 2020

Just thought i'd add, i have never see any Java project using 2 spaces.

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

Successfully merging this pull request may close these issues.

3 participants