[commits-cosmo] (travis) [4315] Ugly formatting.
Travis Vachon
travis at osafoundation.org
Thu May 3 14:18:33 PDT 2007
Oh, actually, that's fine, the only thing I really didn't like was
that the } was at the beginning of the line. Properly indented I have
no problem with it.
-Travis
On May 3, 2007, at 2:04 PM, Matthew Eernisse wrote:
> Travis,
>
> It's not 'ugly formatting,' dude. It's the style specified in our
> Styleguide:
>
> http://wiki.osafoundation.org/Projects/JavaScriptStyleguide
>
> I do believe when I originally put the styleguide together Bobby
> expressed in passing a preference for that other style -- although
> he termed it 'a minor quibble,' IIRC.
>
> If we want to revisit that issue, fine by me, but I think we should
> all code according to whatever style we've agreed on, in the
> interest of having a codebase that's clean and consistent-looking.
>
> The reason I prefer the 'else' on its own line is that it lends
> itself better to putting blocks of comments above the 'if' and then
> above the 'else' in a nice parallel structure:
>
> // If 'something' is true, then go ahead and do
> // a bunch of stuff -- but only if 'something'
> // is true.
> if (something) {
> // Do crap
> }
> // In this case, 'somethingElse' has to be
> // true. Fortunately, this rarely happens.
> else if (somethingElse) {
> // Do other crap
> }
> // This is the default action to take if neither
> // 'something', nor 'somethingElse' are true.
> // We really like the default action, because
> // it's nice.
> else {
> // Do yet some other crap
> }
>
> Sure, you could put the comments underneath, inside the braces, but
> that makes things confusing when you're explaining stuff about the
> things
> being checked in the conditionals.
>
> We could always settle on putting both braces on the line with the
> 'else,' in cases where there are no comments -- but personally I'd
> prefer to keep it consistent through all the code, rather than
> seeing it one way with comments, the other way without. Either way,
> let's pick something, put 'er in the Styleguide, and use it
> consistently.
>
> On a related note, could we also be consistent about putting the
> the proper spacing in between control-structure words (if, while),
> and the parentheses? That provides a nice visual cue that it's a
> conditional, and not a function call. That, and spacing before the
> opening curly brace.
>
> Pretty please? And a pony.
>
> Thanks.
>
>
> Matthew
>
>
> svncheckin at osafoundation.org wrote:
>> Revision
>> 4315 <http://cvs.osafoundation.org/viewcvs.cgi?rev=4315&view=rev>
>> Author
>> travis
>> Date
>> 2007-05-03 12:28:55 -0700 (Thu, 03 May 2007)
>> Log Message
>> Ugly formatting.
>> Modified Paths
>> * cosmo/trunk/cosmo/src/main/webapp/js/cosmo/datetime/Date.js
>> <#cosmotrunkcosmosrcmainwebappjscosmodatetimeDatejs>
>> Diff
>> Modified:
>> cosmo/trunk/cosmo/src/main/webapp/js/cosmo/datetime/Date.js
>> (4314 => 4315)
>> --- cosmo/trunk/cosmo/src/main/webapp/js/cosmo/datetime/Date.js
>> 2007-05-03 17:41:30 UTC (rev 4314)
>> +++ cosmo/trunk/cosmo/src/main/webapp/js/cosmo/datetime/Date.js
>> 2007-05-03 19:28:55 UTC (rev 4315)
>> @@ -507,8 +507,7 @@
>> var ret = null;
>> if (typeof interv == 'string') {
>> ret = Date.diff(interv, sdt1.getTime(), sdt2.getTime());
>> -}
>> - else {
>> + } else {
>> ret = dojo.date.diff(sdt1.getTime(), sdt2.getTime(),
>> interv);
>> }
>> return ret;
>> ---------------------------------------------------------------------
>> ---
>> _______________________________________________
>> Commits-Cosmo mailing list
>> Commits-Cosmo at osafoundation.org
>> http://lists.osafoundation.org/cgi-bin/mailman/listinfo/commits-cosmo
>
> _______________________________________________
> Commits-Cosmo mailing list
> Commits-Cosmo at osafoundation.org
> http://lists.osafoundation.org/cgi-bin/mailman/listinfo/commits-cosmo
More information about the Commits-Cosmo
mailing list