diff options
author | ChangBo Guo(gcb) <eric.guo@easystack.cn> | 2014-06-07 10:49:20 +0800 |
---|---|---|
committer | ChangBo Guo(gcb) <eric.guo@easystack.cn> | 2014-06-18 12:59:02 +0800 |
commit | 0bea84ac20fe498bd08f7212a0017196c8cb0812 (patch) | |
tree | 219628e5d4b8d931cfe8d0f75f17dd7ae111faca /HACKING.rst | |
parent | ee051ea6bcc097ef867aee793cec5710acf827fe (diff) | |
download | nova-0bea84ac20fe498bd08f7212a0017196c8cb0812.tar.gz |
Removes the use of mutables as default args
Passing mutable objects as default args is a known Python pitfall.
We'd better avoid this. This commit changes mutable default args with
None, then use 'arg = arg or {}', 'arg = arg or []'. For unit code which
doesn't use the args , just set with None. This commit also adds hacking
check.
Closes-Bug: #1327473
Change-Id: I5a8492bf8ffef8e000b13b6bdfaef1968b96f816
Diffstat (limited to 'HACKING.rst')
-rw-r--r-- | HACKING.rst | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/HACKING.rst b/HACKING.rst index 1fa7dab6de..0d30194b61 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -34,6 +34,7 @@ Nova Specific Commandments - [N320] Setting CONF.* attributes directly in tests is forbidden. Use self.flags(option=value) instead. - [N321] Validate that LOG messages, except debug ones, have translations +- [N322] Method's default argument shouldn't be mutable Creating Unit Tests ------------------- |