The code style conventions used in the project are based on the style-guide defined of Fedora-3. They should prevent commits cluttered with format changes.
Here are the major rules:
- Four space indents for Java, and 2-space indents for XML. NO TABS
K&R style braces
- Do not use wildcard imports
- Write Javadocs for public methods and classes. Keep it short and to the point
- Avoid public instance variables; use accessors
- Use public methods sparingly; implementation details are not public
- Maximum length of lines is 120 characters.
Create Javadocs for types of at least the following descriptivity
Each source file should contain a license header much like the following:
Use the maven-license-plugin to check for and add missing headers:
IDE settings are located in the project source. IDE users are strongly recommended to apply these formatting settings.
- Eclipse settings are here: fcrepo4/src/site/eclipse
- IntelliJ settings TBD (purportedly, this plugin will let you use the Eclipse settings above within IntelliJ)
We're in the process of adding checkstyle enforcement to our modules (meaning, if you violate some of the major style rules, the build will fail).
To check for violations, run the following command: