Opened 13 years ago

Closed 12 years ago

#1661 closed defect (fixed)

JS Style Guide examples don't follow rules - if(foo) vs. if (foo)

Reported by: skinner Owned by: Neil Roberts
Priority: lowest Milestone: 0.9
Component: Doc parser Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

On the Dojo coding style guide web page, the example code doesn't follow all the layout rules listed on the page:

http://dojotoolkit.org/js_style_guide.html#layout

In the "Layout" section, under "Whitespace", it says:

2. Reserved words SHOULD be followed by a space.

But in most of the example code in the "Layout" section, the reserved words are not followed by a space. For instance, the first example in the "Layout" section reads:

while(!isDone){
    doSomething();
    isDone = moreToDo();
}

rather than:

while (!isDone){
    doSomething();
    isDone = moreToDo();
}

Oddly, some of the example do include occassional spaces after reserved words:

do{
    statements;
}while (condition);
switch (condition){
try{
    statements;
}catch (ex){

Seems like we should either change the example code or change the rule.

Change History (2)

comment:1 Changed 13 years ago by neil

Owner: changed from neil to Neil Roberts

comment:2 Changed 12 years ago by alex

Resolution: fixed
Status: newclosed

I've updated the style guide to be un-ambiguious regarding these whitespace issues:

http://dojotoolkit.org/developer/StyleGuide

Note: See TracTickets for help on using tickets.