Edgewall Software

Changes between Version 27 and Version 28 of TracDev/CodingStyle


Ignore:
Timestamp:
May 3, 2015, 12:28:32 AM (9 years ago)
Author:
figaro
Comment:

Cosmetic changes

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/CodingStyle

    v27 v28  
    2525
    2626 - Use `"..."` for text meant to be read by users,
    27    use `'...'` for string constants (e.g. keys in dicts, CSS class names, filenames).
     27   use `'...'` for string constants, eg keys in dicts, CSS class names, filenames.
    2828   The former strings will usually be translated, so be sure to play nice with the i18n conventions ([[TracL10N#ForDevelopers]]).
    2929   In fact, the only "..." strings that won't get translated are the messages for the log.
     
    3434
    3535== Miscellaneous
    36  * '''Lines shouldn't exceed a length of 79 characters.''' [[br]]
    37    No, it's not because we're using VT100 terminals while developing Trac,
    38    rather because the diffs look nicer on short lines, especially in side-by-side mode.
    39  * ''Never'' use multiple statements on the same line, e.g. `if check: a = 0`.
     36
     37 * '''Lines shouldn't exceed a length of 79 characters''', so that the diffs look nicer on short lines, especially in side-by-side mode.
     38 * Never use multiple statements on the same line, eg `if check: a = 0`.
    4039 * Prefer list comprehension to the built-in functions `filter()` and `map()` when appropriate.
    4140 * Use `raise TracError("message")` instead of `raise TracError, "message"`
     
    5554!JavaScript code should follow [http://javascript.crockford.com/code.html these conventions] with the following exceptions and additions:
    5655* Lines shouldn't exceed a length of 79 characters.
    57 * Use two spaces for indentation.
     56* Use two spaces for indentation and refrain from using tabs.
    5857* Use `lowercase` for variable names.
    5958* Use `camelCase` for functions.
    60 * Define non-anonymous functions as `function fooBar() {...}` (rather than `var fooBar = function() {...}`)
    61 * Keep as much as possible private, by defining private functions in an inner scope. Attach functions you want to export to the $ symbol.
     59* Define non-anonymous functions as `function fooBar() {...}`, rather than `var fooBar = function() {...}`.
     60* Keep as much as possible private, by defining private functions in an inner scope. Attach functions you want to export to the `$` symbol.
    6261* Use a `trac-` prefix for all id and class names. This is for new names, because changing old names would break customizations.
    6362* Prefix variables containing a jQuery object with `$`.