SeaMonkey:MailNews:CodingStyle: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 3: Line 3:


Basically, the [https://developer.mozilla.org/En/Developer_Guide/Coding_Style Mozilla C++ coding style guide rules] apply. But our MailNews code has <strike>grown</strike> evolved over the years and can be rather <strike>twisted</strike> complex, thus we favour '''readability''' over brevity.
Basically, the [https://developer.mozilla.org/En/Developer_Guide/Coding_Style Mozilla C++ coding style guide rules] apply. But our MailNews code has <strike>grown</strike> evolved over the years and can be rather <strike>twisted</strike> complex, thus we favour '''readability''' over brevity.
=== General ===
==== No whitespace crusades ====
Yes, many MailNews code is misaligned, uses tabs instead of spaces for indentation, has trailing whitespace and what not. If doing stuff in the vincinity, fine, do the clean up. But don't touch it just for arbitrary whitespace correction, this just messes up the "whodunnit" history in our repository (and you don't want to look responsible for <strike>Blake's</strike> someone else's code, do you?).


=== JavaScript ===
=== JavaScript ===
In general, use the C++ rules above, but take care of these exceptions:
In general, use the C++ rules above, but take care of these exceptions:
==== Capitalize function names ====
All names should use CamelCase, not under_score_delimiters. But while variable names should begin with lowercase characters, functions (incl. member functions) should begin with an uppercase letter:
function CallSomething(ax)
{
  var conspiracy = ax;
  return conspiracy;
}
==== Default bracing style is "curly braces go on their own line" ====
==== Default bracing style is "curly braces go on their own line" ====
To enhance readability, curly braces should be aligned vertically:
To enhance readability, curly braces should be aligned vertically:
235

edits

Navigation menu