zun/HACKING.rst
Ngo Quoc Cuong 1d3d04150c Delete log translation functions and add hacking rule
The i18n team has decided not to translate the logs because it seems
like it not very useful; operators prefer to have them in English so
that they can search for those strings on the internet.

Since we have removed log translations completely, we should add hacking
rule to prevent future mistakes.

Change-Id: I3ec4ae79db525640bb5d6369727985d5071b7fd4
2017-07-03 03:40:34 -04:00

1000 B

Zun Style Commandments

Read the OpenStack Style Commandments https://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).
  • [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()
  • [Z352] LOG.warn is deprecated. Enforce use of LOG.warning.
  • [Z353] Don't translate logs.