This repository has been archived by the owner on Feb 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Style Guidelines
dwightguth edited this page Apr 11, 2014
·
6 revisions
- No tabs. All indents should be four spaces.
- No line should be longer than 99 characters, except import statements, which should be one per line.
- Java code must declare the package it is part of.
- Imports should not be present unless they are used in the file.
-
import foo.*
should be used sparingly, only when it improves code readability. - Imports should be used whenever a qualified path is required, except in the case of namespace conflicts.
-
long
literals shall be declared with an uppercase "L". - There shall be one outer type per file, named the same as the filename.
- Text files shall end in a new line character.
- Code should not follow the pattern
if (something) { return true; } else { return false; }
or other similar patterns. - Comparison of a String literal to a String object reference should follow the pattern
"foo".equals(bar);
- In interfaces, all methods and the declaration itself should be javadoc'd.
- In enums, all enum values and the declaration itself should be javadoc'd.
- In classes, fields which have complex meaning, or methods which perform complex tasks, should be javadoc'd, as should the class itself.
Copyright notices shall be present in all files, and kept up to date. For example, in Java classes, the first line of any file which was created in 2012 and last modified in 2014 should be:
// Copyright (C) 2012-2014 K Team. All Rights Reserved.
The copyright notice is whitespace and capitalization sensitive. Whenever modifying a file, the copyright notice should be updated to end with the current year. This will be accomplished by means of periodic changes to the checkstyle xml file every January 1.
For information on the precise syntax of copyright notices in other languages, please refer to the checkstyle specification