We’ve established some more complete and official style guidelines for Sponge.
It is largely following in the footsteps of Google’s Java style.
This replaces the rules previously mentioned in the Contribution Guidelines document.
We’ve established some more complete and official style guidelines for Sponge.
It is largely following in the footsteps of Google’s Java style.
This replaces the rules previously mentioned in the Contribution Guidelines document.
sk, a lot of people are still missing this thread :(. Therefore continuing to break guide lines and having a @turt2live rampaging all over them <3 turt
My mailbox are exploding xD
Good work @turt2live
Could one create a format profile for eclipse?
I’ve followed this tutorial to create a eclipse formatter profile from the checkstyle.xml.
EDIT: I’ve created a pull request for this, where you can also view the settings.xml file
Yay for coding standards!
(particular yay for coding standards I like! )
Check your PR. Few missing styles from checkstyle itself but are from the usual coding conventions
I’ve updated the PR. Thanks for you review!
I always learned constants in Java should be all uppercase letters.
Google Java Style also uses this style: https://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s5.2.4-constant-names
This is what I found in the Sponge Style Guidelines:
private static final Logger log = Logger.getLogger(ExampleClass.class);
private static final Random random = new Random();
private final String id = "test";
@sk89q Is this suppose to be?
The section of documentation you linked includes almost the same examples as those you quote - those aren’t considered constants because either they are mutable (log
and random
), or they’re not static (id
).
Good to have new guidelines for code. Previous one wasn’t very clear in all cases.
Okay, thanks for clearing that out!
So when using the Sponge Style Guidelines, this would be in uppercase letters?
static final int NUMBER = 5;
Yes, that’s still uppercase because it’s all three of static, final, and immutable (cannot be changed by calling methods on it).