Code Standards

One of the most significant advantages to using a common version control system, such as Mercurial, is that we can easily identify the incremental changes in the code as we develop the project.  A common issue in many projects is that developers will commit changes that modify white-space and line endings accidentally (because of their editor, etc), which will obscure the actual code change that they have made.  To avoid such issues, we must all agree to use a few strict rules regarding the code.  This document will outline those rules.  We ask that all developers adhere to these standards.

Mistakes will be made, of course.  We ask that the developer who commits non-standard code revert the ENTIRE change that does not meet standards, and resubmit the change to the repo when it is in compliance.

 

Accepted Standards

  • All line endings will be a single LF character, as is normal on a *nix system.  Windows-style CRLF endings are not in compliance.
  • No TAB characters are to be used.  Indentation is in 4-SPACE units.
  • A commit will include ONLY the code change that is desired.  If there are clean-up issues in the code, they should be made in a SEPARATE commit.  It should not be necessary to review 40 changes (in which 39 are clean-up) to find the 1 that is the focus of the commit.
  • No code will be commited to the stable repo unless it has first been committed, and has been fully tested, in the unstable repo.  The stable repo is not the place to debug your changes.

 

This document should be considered a work-in-progress.  Please check back frequently to see if there are changes, and adopt them to your workflow immediately.

Published on  October 26th, 2011