zun/HACKING.rst
prameswar b316efa05a Changed hacking check prefix 'M' to 'Z'
Closes-bug: #1651523

Change-Id: I6ae56eceea64d37fa81de11985b2950da55198da
2016-12-20 23:28:39 +05:30

1009 B

Zun Style Commandments

Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/

Zun Specific Commandments

  • [Z302] Change assertEqual(A is not None) by optimal assert like assertIsNotNone(A).
  • [Z310] timeutils.utcnow() wrapper must be used instead of direct calls to datetime.datetime.utcnow() to make it easy to override its return value.
  • [Z316] Change assertTrue(isinstance(A, B)) by optimal assert like assertIsInstance(A, B).
  • [Z318] Change assertEqual(A, None) or assertEqual(None, A) by optimal assert like assertIsNone(A)
  • [Z322] Method's default argument shouldn't be mutable.
  • [Z323] Change assertEqual(True, A) or assertEqual(False, A) by optimal assert like assertTrue(A) or assertFalse(A)
  • [Z336] Must use a dict comprehension instead of a dict constructor with a sequence of key-value pairs.
  • [Z338] Use assertIn/NotIn(A, B) rather than assertEqual(A in B, True/False).
  • [Z339] Don't use xrange()