Document the reasoning behind general hacking rules

Try to answer the question why do we have this rule.

Change-Id: I983c754d3455e227d10e5ad7e5bcc3924e079103
This commit is contained in:
Joe Gordon
2015-05-19 10:00:21 -07:00
parent 93d7f7fcfb
commit 0c4aafb07e

View File

@@ -22,11 +22,15 @@ General
- [H903] Use only UNIX style newlines (``\n``), not Windows style (``\r\n``) - [H903] Use only UNIX style newlines (``\n``), not Windows style (``\r\n``)
- It is preferred to wrap long lines in parentheses and not a backslash - It is preferred to wrap long lines in parentheses and not a backslash
for line continuation. for line continuation.
- [H201] Do not write ``except:``, use ``except Exception:`` at the very least - [H201] Do not write ``except:``, use ``except Exception:`` at the very least.
- [H101] Include your name with TODOs as in ``# TODO(yourname)`` When catching an exception you should be as specific so you don't mistakenly
- [H105] Don't use author tags. catch unexpected exceptions.
- [H106] Don't put vim configuration in source files (off by default) - [H101] Include your name with TODOs as in ``# TODO(yourname)``. This makes
- Do not shadow a built-in or reserved word. Example:: it easier to find out who the author of the comment was.
- [H105] Don't use author tags. We use version control instead.
- [H106] Don't put vim configuration in source files (off by default).
- Do not shadow a built-in or reserved word. Shadowing built -in or reserved
words makes the code harder to understand. Example::
def list(): def list():
return [1, 2, 3] return [1, 2, 3]
@@ -42,12 +46,13 @@ General
Imports Imports
------- -------
- Do not import objects, only modules (*) - Do not import objects, only modules (*)
- [H301] Do not import more than one module per line (*) - [H301] Do not import more than one module per line (*)
- [H303] Do not use wildcard ``*`` import (*) - [H303] Do not use wildcard ``*`` import (*)
- [H304] Do not make relative imports - [H304] Do not make relative imports
- [H306] Order your imports by the full module path - [H306] Alphabetically order your imports by the full module path.
- Organize your imports according to the `Import order Organize your imports according to the `Import order
template`_ and `Real-world Import Order Examples`_ below. template`_ and `Real-world Import Order Examples`_ below.
(*) exceptions are: (*) exceptions are: