magnum/HACKING.rst
Vivek Jain 28c8014ff0 Add hacking rule for explicit import of _ function
Change-Id: Id0c1610f0b6353a43341f704e0b4b00bd04828bb
Closes-bug: #1490194
2016-07-29 23:17:06 +05:30

30 lines
1.2 KiB
ReStructuredText

Magnum Style Commandments
=========================
- Step 1: Read the OpenStack Style Commandments
http://docs.openstack.org/developer/hacking/
- Step 2: Read on
Magnum Specific Commandments
----------------------------
- [M302] Change assertEqual(A is not None) by optimal assert like
assertIsNotNone(A).
- [M310] timeutils.utcnow() wrapper must be used instead of direct calls to
datetime.datetime.utcnow() to make it easy to override its return value.
- [M316] Change assertTrue(isinstance(A, B)) by optimal assert like
assertIsInstance(A, B).
- [M318] Change assertEqual(A, None) or assertEqual(None, A) by optimal assert
like assertIsNone(A)
- [M319] Change assertNotEqual(A, None) or assertNotEqual(None, A)
by optimal assert like assertIsNotNone(A)
- [M322] Method's default argument shouldn't be mutable.
- [M323] Change assertEqual(True, A) or assertEqual(False, A) by optimal assert
like assertTrue(A) or assertFalse(A)
- [M336] Must use a dict comprehension instead of a dict constructor
with a sequence of key-value pairs.
- [M338] Use assertIn/NotIn(A, B) rather than assertEqual(A in B, True/False).
- [M339] Don't use xrange()
- [M340] Check for explicit import of the _ function.
- [M352] LOG.warn is deprecated. Enforce use of LOG.warning.