Changes between Version 23 and Version 24 of Contributing/CodingStyle


Ignore:
Timestamp:
11/13/2016 11:52:03 AM (7 years ago)
Author:
Cas
Comment:

update info on single quote and checking

Legend:

Unmodified
Added
Removed
Modified
  • Contributing/CodingStyle

    v23 v24  
    44 
    55== Common == 
    6  * Line length: Maximum of `119` rather than usual `79`. That said, where possible keep to `79`. 
     6 * Line length: Maximum of `119` rather than usual `79`. That said, where possible keep it between `79-99` to keep it readable. 
    77 * Indent: `4 spaces`, no tabs. 
     8 * All code should use `'single quotes'`. 
    89 
    910== Python == 
    10 Mostly follow [http://www.python.org/dev/peps/pep-0008/ PEP8] and [http://docs.python-guide.org/en/latest/writing/style/ Python Code Style] with the following exceptions: 
    11  * Line length ''(see above)'' 
     11 Deluge follows [http://www.python.org/dev/peps/pep-0008/ PEP8] and [http://docs.python-guide.org/en/latest/writing/style/ Python Code Style] with line length the only exception. 
    1212 
    13  * Code '''must''' pass [https://pypi.python.org/pypi/flake8 flake8] and [http://www.pylint.org/ Pylint] source code checkers. 
     13 * Code '''must''' pass [https://pypi.python.org/pypi/flake8 flake8] (w/[https://pypi.python.org/pypi/flake8-quotes flake8-quotes]), [https://pypi.python.org/pypi/isort isort] and [http://www.pylint.org/ Pylint] source code checkers. 
    1414{{{ 
    1515flake8 deluge 
     16isort -rc -df deluge 
    1617pylint deluge  
    1718pylint deluge/plugins/*/deluge/ 
    1819}}} 
    1920 
    20  * All byte arrays (byte strings, `str`) should be decoded to strings (unicode strings, `unicode`) on input and encoded back to byte arrays on output. [http://stackoverflow.com/a/606199/175584 From Stackoverflow:] 
     21 * Using the [http://pre-commit.com/ pre-common] app can aid in picking up issues before creating git commits. 
     22 
     23 * All byte strings (`str`) should be decoded to strings (unicode strings, `unicode`) on input and encoded back to byte strings on output. [http://stackoverflow.com/a/606199/175584 From Stackoverflow:] 
    2124{{{ 
    2225>>> b"abcde" 
     
    2629}}} 
    2730 
    28  **Note:** PyGTK/GTK+ will accept `str` (utf8 encoded) or `unicode` but will only return `str`. See [http://python-gtk-3-tutorial.readthedocs.org/en/latest/unicode.html GTK+ Unicode] docs.  
     31 **Note1:** PyGTK/GTK+ will accept `str` (utf8 encoded) or `unicode` but will only return `str`. See [http://python-gtk-3-tutorial.readthedocs.org/en/latest/unicode.html GTK+ Unicode] docs.  
     32 **Note2:** There is also a `bytearray` type which enables in-place modification of a string. See [http://stackoverflow.com/a/9099337/175584 Python Bytearrays] 
     33 **Note2:** For reference Python 3 renames `unicode` to `str` type and byte arrays becomes `bytes` type. 
    2934 
    3035 * All relative path separators used within code should be converted to posix format `/`, so should not contain `\` or `\\`. This is to prevent confusion when dealing with cross-platform clients and servers. 
     
    5863}}} 
    5964 
    60 === Single or Double Quotes === 
    61  
    62 The python code base should be `"double quotes"`. 
    63  
    6465=== Python References === 
    6566 
     
    8081 * Class names should be in !CamelCase 
    8182 * Instances of classes should use camelCase. 
    82  
    83 === Single or Double Quotes === 
    84  
    85 For the javascript code use `'single quotes'`.