1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-30 10:32:28 +01:00
Files
pentadactyl-pm/HACKING

41 lines
1.4 KiB
Plaintext

== Coding Style ==
In general: Just look at other source code!
We try to be quite consistent, but of course, that's not always possible.
=== The most important style issues are: ===
* Use 4 spaces to indent things, no tabs, not 2, nor 8 spaces. If you use vim,
this should be taken care of automatically by the modeline.
* Use " for enclosing strings instead of ', unless using ' avoids escaping of lots of "
Example: alert("foo") instead of alert('foo');
* Exactly one space after if/for/while/etc. and after a comma, but none after a parenthesis
or after a function call:
for (pre, condition, post)
but:
alert("bla");
* Opening curly brackets { must be on a new line, unless it is used in a closure:
myFunction ()
{
return;
}
but:
setTimeout(function () {
...
});
* Prefer // over /* */ comments (exceptions for big comments are usually ok)
Right: if (HACK) // TODO: remove hack
Wrong: if (HACK) /* TODO: remove hack */
* Use UNIX new lines (\n), not windows (\r\n) or old Mac ones (\r)
== TESTING/OPTIMIZATION ==
TODO: Add some information here about testing/validation/etc.
Information about how/when to use :regressions might be nice.
Additionally, maybe there should be some benchmark information here --
something to let a developer know what's "too" slow...? Or general
guidelines about optimization?