flake8: Enable some off-by-default checks

Enable the following off-by-default checks:
    * [H106] Don't put vim configuration in source files.
    * [H203] Use assertIs(Not)None to check for None.
    * [H204] Use assert(Not)Equal to check for equality.
    * [H205] Use assert(Greater|Less)(Equal) for comparison.
    * [H210] Require ‘autospec’, ‘spec’, or ‘spec_set’ in
             mock.patch/mock.patch.object calls
    * [H904] Delay string interpolations at logging calls.

Fix code that failed [H904]. Nothing else failed the new added checks.

Change-Id: I727c944aad04298de07bcdd1d0008dcb9ffe32e9
This commit is contained in:
John L. Villalovos 2017-09-06 13:30:55 -07:00
parent b3e1b9be94
commit c693d5d04f
3 changed files with 10 additions and 3 deletions

View File

@ -99,8 +99,8 @@ def execute(*cmd, **kwargs):
LOG.debug('Execution completed, command line is "%s"',
' '.join(map(str, cmd)))
if log_stdout:
LOG.debug('Command stdout is: "%s"' % result[0])
LOG.debug('Command stderr is: "%s"' % result[1])
LOG.debug('Command stdout is: "%s"', result[0])
LOG.debug('Command stderr is: "%s"', result[1])
return result

View File

@ -5,7 +5,7 @@
coverage!=4.4,>=4.0 # Apache-2.0
eventlet!=0.18.3,!=0.20.1,<0.21.0,>=0.18.2 # MIT
flake8-import-order==0.11 # LGPLv3
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=1.0.0 # Apache-2.0
mock>=2.0.0 # BSD
os-testr>=0.8.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0

View File

@ -20,6 +20,13 @@ ignore = E129
exclude = .venv,.tox,dist,doc,*.egg,.update-venv
import-order-style = pep8
application-import-names = ironic_lib
# [H106] Don't put vim configuration in source files.
# [H203] Use assertIs(Not)None to check for None.
# [H204] Use assert(Not)Equal to check for equality.
# [H205] Use assert(Greater|Less)(Equal) for comparison.
# [H210] Require autospec, spec, or spec_set in mock.patch/mock.patch.object calls
# [H904] Delay string interpolations at logging calls.
enable-extensions=H106,H203,H204,H205,H210,H904
[testenv:pep8]
commands =