Differences between revisions 4 and 5
Revision 4 as of 2010-11-30 13:45:13
Size: 1100
Editor: 88-110-54-212
Comment: Use a numbered list instead of bullet points
Revision 5 as of 2018-12-20 00:01:40
Size: 0
Editor: JoanTouzet
Comment: Outdated, unfortunately. We need a new one of these.
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
CouchDB comes with code in a variety of different languages. While the core is written in Erlang, there are some parts written in C, others written in HTML, CSS, and Javascript, and then there are also shell scripts, Makefiles, et cetera.

First, some general rules:

 1. Always use spaces for indentation, not tabs, except in Makefiles.
 1. Use four spaces for indentation in Erlang and C code, two spaces in HTML, CSS, and Javascript.
 1. Try to keep lines shorter than 80 characters.
 1. When you edit a file, try to stick with the conventions used in the surrounding code.
 1. Avoid trailing spaces and newlines in your files. Good editors usually have a configuration option that prevents this from happening.
 1. Avoid mixing purely cosmetic changes (such as removing trailing white-space) with functional changes, as that makes review of the actual change (whether it’s a check-in or a patch) much more difficult.

For more detailed coding conventions for Erlang code, please see the [[http://www.erlang.se/doc/programming_rules.shtml|Erlang Programming Rules and Conventions]].