The code style used in Enigmail is derived from the standard code style of js-beautify. We use js-beautify with the following non-default options:
These defaults are committed to the top level source tree and will be automatically used by js-beautify.
Example:
/**
* This is just a sample script.
*/
function tmp(a, b, c) {
try {
if (a === 1 && b.search(/an_example/)) {
of_beautifer();
}
else {
var a = b ? (c % d) : e[f];
}
switch (x) {
case 1:
doSomething();
break;
default:
doDefault(x);
}
}
catch (e) {
// some comment
handleEx();
}
}
Please try to avoid statements that are hard to read such as:
let isError = getStatusFunc()
(isError ? handleError : handleFailure)(a, b c);
We prefer code that is readable code, even if it requires more typing. E.g.:
let isError = getStatusFunc()
if (isError) {
handleError(a,b c);
}
else {
handleFailure(a, b c);
}
Developer Wiki: Development Environment
Developer Wiki: Home
Developer Wiki: Planning for version 1.9