[Freeipa-devel] Proposed Javascript coding standards
Simo Sorce
ssorce at redhat.com
Mon Sep 13 21:46:39 UTC 2010
On Mon, 13 Sep 2010 17:02:19 -0400
Adam Young <ayoung at redhat.com> wrote:
> The is a really nasty bug that the "same line" policy avoids.
> Javascript often attempts to guess where you meant to put semicolons,
> and puts the in for you, without telling you.
>
> return
> {
> status: true;
> };
>
>
> actually returns undefined. I fully acknowledge that this is brain
> dead. There are some really brain-dead "features" in JavaScript.
>
> It is easier to be consistent here, hence the rule "always put it on
> the opening statement line.
Ok, in that case please note the rationale in the coding style.
Also though in that case I think function() { (with the space) is
better than function(){, unless the sapce is what causes javascript to
put in the automatic ';'. If that's the case I hate it :)
> > We also banned C++ style comments in C code, /* */ is preferred and
> > should never be added on the same line of code but only on the
> > previous line.
> >
>
> I'm OK with that rule. C++ style comments are only to be used for
> commenting out code, which probably shouldn't get checked in anyway.
Given space matters in javascript I say that the git history is where
you put unused code, not in comments :)
Simo.
--
Simo Sorce * Red Hat, Inc * New York
More information about the Freeipa-devel
mailing list