After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 612941 - More style issues pointed out by jslint
More style issues pointed out by jslint
Status: RESOLVED OBSOLETE
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-03-15 14:17 UTC by Dan Winship
Modified: 2011-05-19 16:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
More style issues pointed out by jslint (7.11 KB, patch)
2010-03-15 14:17 UTC, Dan Winship
accepted-commit_now Details | Review

Description Dan Winship 2010-03-15 14:17:26 UTC
jslint is insistent that you should always do:

    stuff stuff stuff binary-operator
        stuff stuff stuff

not

    stuff stuff stuff
        binary-operator stuff stuff stuff

in theory this is because of the threat of semicolon insertion, but
semicolon insertion doesn't work that way. (A semicolon can only be
inserted in the middle of an expression if there would be a syntax error
without it.) I guess there's a threat that you could come up with some
(syntactically incorrect) statement such that in the latter case
semicolon-insertion would turn it into two syntactically-correct statements
(neither of which does what you meant) whereas in the former case it
wouldn't...

Anyway, I like the operator-at-end-of-line form better than the
operator-at-start-of-line form anyway. (Especially for cases where the
expression as a whole is not parenthesized.) So I'm in favor of this patch.

I think the other changes (parseInt usage, and adding {}s around multi-line
bodies) are non-controversial.
Comment 1 Dan Winship 2010-03-15 14:17:29 UTC
Created attachment 156178 [details] [review]
More style issues pointed out by jslint

Taken from a patch from Lex Hider on the mailing list.
Comment 2 Owen Taylor 2010-03-15 15:34:45 UTC
Review of attachment 156178 [details] [review]:

For complicated expressions, I do find having the operator on the new line is more readable because it makes the overall structure of the expression clear. I wouldn't say:

  if (focusedApp == this._focusedApp
      && ((lastSequence == null && this._activeSequence == null)
          || (lastSequence != null && this._activeSequence != null
              && lastSequence.get_id() == this._activeSequence.get_id())))

Is *clear*, but it's more clear to me than:

  if (focusedApp == this._focusedApp &&
      ((lastSequence == null && this._activeSequence == null) ||
       (lastSequence != null && this._activeSequence != null &&
        lastSequence.get_id() == this._activeSequence.get_id())))

This used to be an area where I deviated from the GNU coding standards ("When you split an expression into multiple lines, split it before an
operator, not after one."), but at some point I switched my opinion.

However, if we really cared about clarity, we'd probably want to break that up anyways, and it's certainly not a strong opinion on my part, so I'm fine with the change. Rest of the changes look good. The commit message should really list the style points being addressed.
Comment 3 Dan Winship 2011-05-19 16:05:38 UTC
this patch is really out of date now