2013-07-29 17:05:02 -05:00
|
|
|
OpenStack Style Commandments
|
|
|
|
|
============================
|
|
|
|
|
|
2013-11-11 11:09:04 -08:00
|
|
|
- Step 1: Read the OpenStack Style Commandments
|
2017-07-24 11:32:22 +08:00
|
|
|
https://docs.openstack.org/hacking/latest/
|
2013-11-11 11:09:04 -08:00
|
|
|
- Step 2: Read on
|
2013-07-29 17:05:02 -05:00
|
|
|
|
|
|
|
|
General
|
|
|
|
|
-------
|
2020-10-01 21:50:40 +01:00
|
|
|
|
2013-07-29 17:05:02 -05:00
|
|
|
- thou shalt not violate causality in our time cone, or else
|
|
|
|
|
|
|
|
|
|
Docstrings
|
|
|
|
|
----------
|
|
|
|
|
|
|
|
|
|
Docstrings should ONLY use triple-double-quotes (``"""``)
|
|
|
|
|
|
|
|
|
|
Single-line docstrings should NEVER have extraneous whitespace
|
|
|
|
|
between enclosing triple-double-quotes.
|
|
|
|
|
|
|
|
|
|
Deviation! Sentence fragments do not have punctuation. Specifically in the
|
|
|
|
|
command classes the one line docstring is also the help string for that
|
|
|
|
|
command and those do not have periods.
|
|
|
|
|
|
|
|
|
|
"""A one line docstring looks like this"""
|
|
|
|
|
|
|
|
|
|
Calling Methods
|
|
|
|
|
---------------
|
|
|
|
|
|
|
|
|
|
Deviation! When breaking up method calls due to the 79 char line length limit,
|
2013-11-11 11:09:04 -08:00
|
|
|
use the alternate 4 space indent. With the first argument on the succeeding
|
2013-07-29 17:05:02 -05:00
|
|
|
line all arguments will then be vertically aligned. Use the same convention
|
|
|
|
|
used with other data structure literals and terminate the method call with
|
|
|
|
|
the last argument line ending with a comma and the closing paren on its own
|
2021-03-31 18:18:55 +01:00
|
|
|
line indented to the starting line level. ::
|
2013-07-29 17:05:02 -05:00
|
|
|
|
|
|
|
|
unnecessarily_long_function_name(
|
|
|
|
|
'string one',
|
|
|
|
|
'string two',
|
|
|
|
|
kwarg1=constants.ACTIVE,
|
|
|
|
|
kwarg2=['a', 'b', 'c'],
|
|
|
|
|
)
|