You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

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.

Formatting Rules

Here are the major rules:

  1. Four space indents for Java, and 2-space indents for XML. NO TABS
  2. K&R style braces

    if (code) {
      // code
    } else {
      // code
    }
    
  3. Do not use wildcard imports
  4. Write Javadocs for public methods and classes. Keep it short and to the point
  5. Avoid public instance variables; use accessors
  6. Use public methods sparingly; implementation details are not public
  7. Maximum length of lines is 80 characters.
  8. Create Javadocs for types of at least the following descriptivity

    /**
     * @author Joe Developer
     * @date MMM DD, YYYY
     */
    public class MyClass
  9. Include the following license statement as a header for every file (using appropriate commenting syntax):

    /** 
     * The contents of this file are subject to the license and copyright terms
     * detailed in the license directory at the root of the source tree (also
     * available online at http://fedora-commons.org/license/).
     */

IDE Setups

IDE settings can be found in fcrepo4/etc in the project source.

Checkstyle

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).

https://github.com/futures/fcrepo4/blob/master/checkstyle.xml

  • No labels