manila/HACKING.rst
Tom Barron 66a6505d79 remove hacking rule that enforces log translation
Log translation is no longer being done [1] [2] so there
is no point in enforcing it going forwards.

Remove the hacking enforcement so that new commits need
not include this unused feature and so that we can remove
this unused il8n markup in existing code.

[1] http://lists.openstack.org/pipermail/openstack-dev/2017-March/thread.html#113365
[2] https://review.openstack.org/#/c/446762/

Change-Id: I31f35b0597e161a1654467f5a0a2348789292d83
2017-03-17 05:54:03 -04:00

4.1 KiB

Manila Style Commandments

Manila Specific Commandments

  • [M310] Check for improper use of logging format arguments.
  • [M312] Use assertIsNone(...) instead of assertEqual(None, ...).
  • [M313] Use assertTrue(...) rather than assertEqual(True, ...).
  • [M319] Validate that debug level logs are not translated.
  • [M323] Ensure that the _() function is explicitly imported to ensure proper translations.
  • [M325] str() and unicode() cannot be used on an exception. Remove or use six.text_type().
  • [M326] Translated messages cannot be concatenated. String should be included in translated message.
  • [M333] oslo_ should be used instead of oslo.
  • [M336] Must use a dict comprehension instead of a dict constructor with a sequence of key-value pairs.
  • [M337] Ensure to not use xrange().
  • [M354] Use oslo_utils.uuidutils to generate UUID instead of uuid4().
  • [M338] Ensure to not use LOG.warn().

LOG Translations

Beginning with the Pike series, OpenStack no longer supports log translation. It is not useful to add translation instructions to new code, the instructions can be removed from old code, and the hacking checks that enforced use of special translation markers for log messages have been removed.

Other user-facing strings, e.g. in exception messages, should be translated using _().

A common pattern is to define a single message object and use it more than once, for the log call and the exception. In that case, _() must be used because the message is going to appear in an exception that may be presented to the user.

For more details about translations, see http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Creating Unit Tests

For every new feature, unit tests should be created that both test and (implicitly) document the usage of said feature. If submitting a patch for a bug that had no unit test, a new passing unit test should be added. If a submitted bug fix does have a unit test, be sure to add a new one that fails without the patch and passes with the patch.

For more information on creating unit tests and utilizing the testing infrastructure in OpenStack Manila, please read manila/testing/README.rst.

Running Tests

The testing system is based on a combination of tox and testr. If you just want to run the whole suite, run tox and all will be fine. However, if you'd like to dig in a bit more, you might want to learn some things about testr itself. A basic walkthrough for OpenStack can be found at http://wiki.openstack.org/testr

OpenStack Trademark

OpenStack is a registered trademark of OpenStack, LLC, and uses the following capitalization:

OpenStack

Commit Messages

Using a common format for commit messages will help keep our git history readable. Follow these guidelines:

First, provide a brief summary (it is recommended to keep the commit title under 50 chars).

The first line of the commit message should provide an accurate description of the change, not just a reference to a bug or blueprint. It must be followed by a single blank line.

If the change relates to a specific driver (libvirt, xenapi, qpid, etc...), begin the first line of the commit message with the driver name, lowercased, followed by a colon.

Following your brief summary, provide a more detailed description of the patch, manually wrapping the text at 72 characters. This description should provide enough detail that one does not have to refer to external resources to determine its high-level functionality.

Once you use 'git review', two lines will be appended to the commit message: a blank line followed by a 'Change-Id'. This is important to correlate this commit with a specific review in Gerrit, and it should not be modified.

For further information on constructing high quality commit messages, and how to split up commits into a series of changes, consult the project wiki:

http://wiki.openstack.org/GitCommitMessages