Add documentation about off-by-default options
Add documentation on off-by-default options and how to enable them. Change-Id: I34fc44f92ac7e8e800b1d8d07914af62cb2679ae
This commit is contained in:
parent
7c360d21c7
commit
aff899adb5
|
@ -32,7 +32,7 @@ General
|
|||
it easier to find out who the author of the comment was.
|
||||
- [H105] Don't use author tags. We use version control instead.
|
||||
- [H106] Don't put vim configuration in source files (off by default).
|
||||
- [H904] Delay string interpolations at logging calls.
|
||||
- [H904] Delay string interpolations at logging calls (off by default).
|
||||
- Do not shadow a built-in or reserved word. Shadowing built -in or reserved
|
||||
words makes the code harder to understand. Example::
|
||||
|
||||
|
@ -304,7 +304,8 @@ exception possible should be used.
|
|||
with self.assertRaises(exception.InstanceNotFound):
|
||||
db.instance_get_by_uuid(elevated, instance_uuid)
|
||||
|
||||
- [H203] Unit test assertions tend to give better messages for more specific
|
||||
- [H203] Use assertIs(Not)None to check for None (off by default)
|
||||
Unit test assertions tend to give better messages for more specific
|
||||
assertions. As a result, ``assertIsNone(...)`` is preferred over
|
||||
``assertEqual(None, ...)`` and ``assertIs(None, ...)``, and
|
||||
``assertIsNotNone(...)`` is preferred over ``assertNotEqual(None, ...)``
|
||||
|
|
17
README.rst
17
README.rst
|
@ -88,6 +88,23 @@ Requirements
|
|||
Importing random modules, has caused all kinds of trouble for us in the past.
|
||||
|
||||
|
||||
Enabling off-by-default checks
|
||||
==============================
|
||||
|
||||
Some of the available checks are disabled by default. These checks are:
|
||||
|
||||
- [H106] Don't put vim configuration in source files.
|
||||
- [H203] Use assertIs(Not)None to check for None.
|
||||
- [H904] Delay string interpolations at logging calls.
|
||||
|
||||
To enable these checks, edit the ``flake8`` section of the ``tox.ini`` file.
|
||||
For example to enable H106 and H203:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[flake8]
|
||||
enable-extensions = H106,H203
|
||||
|
||||
Local Checks
|
||||
============
|
||||
|
||||
|
|
Loading…
Reference in New Issue