aboutsummaryrefslogtreecommitdiffstats
path: root/keystone-moon/HACKING.rst
diff options
context:
space:
mode:
authorWuKong <rebirthmonkey@gmail.com>2015-06-30 18:47:29 +0200
committerWuKong <rebirthmonkey@gmail.com>2015-06-30 18:47:29 +0200
commitb8c756ecdd7cced1db4300935484e8c83701c82e (patch)
tree87e51107d82b217ede145de9d9d59e2100725bd7 /keystone-moon/HACKING.rst
parentc304c773bae68fb854ed9eab8fb35c4ef17cf136 (diff)
migrate moon code from github to opnfv
Change-Id: Ice53e368fd1114d56a75271aa9f2e598e3eba604 Signed-off-by: WuKong <rebirthmonkey@gmail.com>
Diffstat (limited to 'keystone-moon/HACKING.rst')
-rw-r--r--keystone-moon/HACKING.rst58
1 files changed, 58 insertions, 0 deletions
diff --git a/keystone-moon/HACKING.rst b/keystone-moon/HACKING.rst
new file mode 100644
index 00000000..86bce201
--- /dev/null
+++ b/keystone-moon/HACKING.rst
@@ -0,0 +1,58 @@
+Keystone Style Commandments
+===========================
+
+- Step 1: Read the OpenStack Style Commandments
+ http://docs.openstack.org/developer/hacking/
+- Step 2: Read on
+
+Keystone Specific Commandments
+------------------------------
+
+- Avoid using "double quotes" where you can reasonably use 'single quotes'
+
+
+TODO vs FIXME
+-------------
+
+- TODO(name): implies that something should be done (cleanup, refactoring,
+ etc), but is expected to be functional.
+- FIXME(name): implies that the method/function/etc shouldn't be used until
+ that code is resolved and bug fixed.
+
+
+Logging
+-------
+
+Use the common logging module, and ensure you ``getLogger``::
+
+ from oslo_log import log
+
+ LOG = log.getLogger(__name__)
+
+ LOG.debug('Foobar')
+
+
+AssertEqual argument order
+--------------------------
+
+assertEqual method's arguments should be in ('expected', 'actual') order.
+
+
+Properly Calling Callables
+--------------------------
+
+Methods, functions and classes can specify optional parameters (with default
+values) using Python's keyword arg syntax. When providing a value to such a
+callable we prefer that the call also uses keyword arg syntax. For example::
+
+ def f(required, optional=None):
+ pass
+
+ # GOOD
+ f(0, optional=True)
+
+ # BAD
+ f(0, True)
+
+This gives us the flexibility to re-order arguments and more importantly
+to add new required arguments. It's also more explicit and easier to read.