Edgewall Software

Changes between Version 33 and Version 34 of TracDev/CodingStyle


Ignore:
Timestamp:
Sep 7, 2017, 11:07:28 PM (7 years ago)
Author:
Ryan J Ollos
Comment:

Fix link and add a few more rules.

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/CodingStyle

    v33 v34  
    44
    55Code is read more often than it is written, so we adhere to a coding style. Patches that:
     6 - have tabs rather than spaces
    67 - have long lines
    78 - have multiple statements per line
     
    1112Like most Python projects, we adhere to [pep:0008 PEP 8 (Style Guide for Python Code)] and [pep:0257 PEP 257 (Docstring Conventions)]. Be sure to read those documents if you intend to contribute code to Trac.
    1213
    13 Starting with version 1.3.1 the codebase should be compatible with Python 2 and 3, specifically Python 2.7 and Python 3.3+. The [https://docs.djangoproject.com/en/dev/topics/python3/ Django Python 2/3 guidelines] should be followed.
     14Starting with version 1.5.1 the codebase should be compatible with Python 2 and 3, specifically Python 2.7 and Python 3.3+. The [https://docs.djangoproject.com/en/1.11/topics/python3/ Django Python 2/3 guidelines] should be followed.
    1415
    15 Note that some of the current Trac code could violate coding style rules. We are always in the process of refactoring the offending modules so that all code adheres to the conventions.
     16Note that some of the current Trac code violates coding style rules. We are always in the process of refactoring the offending modules so that all code adheres to the conventions.
    1617
    1718== Naming conventions
     
    5354 * Code blocks are copiously documented, describing the code blocks' functionality concisely.
    5455 * Avoid using `except Exception`, instead making the exception clause as narrow as necessary to catch the excepted exception.
     56* Move code out of the `try` statement that cannot raise the exception being trapped, placing it before, after, or in an `else` clause, as appropriate.
    5557
    5658== !JavaScript
     
    6971
    7072* Empty tags should have a single whitespace before the closing bracket, `/>`. For example, `<br />` and `<input type="text" ... />`.
    71 * Omit the curly braces for variables in Genshi templates, using `$var` rather than `${var}`.
     73* Use curly braces for variables in Genshi templates, using `${var}` rather than `$var`, as this is required for Jinja2 templates.
    7274
    7375== SQL
     
    7880* Reserved words are uppercase: `SELECT` instead of `select`, `INTEGER` instead of `integer`.
    7981* Avoid abbreviations and if you have to use them make sure they are commonly understood.
    80 * Do not prefix with `tbl` or any other prefix or Hungarian notation.
     82* Do not prefix with `tbl` or any other prefix, or Hungarian notation.
    8183* Do not give a table the same name as one of its columns and vice versa.
    8284