This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 121
Code Style
mastercoms edited this page Sep 8, 2014
·
6 revisions
This page documents code style guidelines. For general contributing guidelines, see CONTRIBUTING.md.
- Generally, follow Oracle's formatting standards (alt link).
- No tabs - use 4 spaces instead.
- All submitted code must follow [Java Conventions].
- The indentation should solely consist of 4 spaces instead of tabs.
- No trailing whitespaces for code lines, comments or configuration files.
- No CRLF line endings, only LF is allowed.
- For Windows-based machines, you can configure Git to do this for your by running
git config --global core.autocrlf true
. - If you're running a Linux or Mac OSX, you should run
git config --global core.autocrlf input
instead. - For more information about line feeds. See this this article.
- No 80 character line limit or 'weird' midstatement newlines.
- Avoid nested code structures.
- All files must end with a new line.
Javadoc guidelines (not completely strict):
-
@Override
methods should not have docs. They inherit their parent's docs. - Public and protected methods on public classes should have docs.
- Private methods should have docs when their function is non-obvious.
- Public classes except protocol internals should have docs.
- Fields on classes that are not simple data structures should have docs.
- When in doubt, docs.