Update to hacking 0.12.0 and use new checks

Use hacking 0.12.0

Use the new checks that are available:
    [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.

Fix code so tests pass.

Change-Id: I7b1cd98aeb3bb8f4f01dd1d69d1afcd839749074
This commit is contained in:
John L. Villalovos 2016-11-09 05:37:10 -08:00
parent cd253c3ad6
commit ba9adaa2f5
5 changed files with 10 additions and 6 deletions

View File

@ -49,7 +49,7 @@ def _iptables(*args, **kwargs):
LOG.debug('Ignoring failed iptables %(args)s: %(output)s',
{'args': args, 'output': output})
else:
LOG.error(_LE('iptables %(iptables)s failed: %(exc)s') %
LOG.error(_LE('iptables %(iptables)s failed: %(exc)s'),
{'iptables': args, 'exc': output})
raise

View File

@ -510,8 +510,8 @@ def find_node(**attributes):
if not isinstance(value, list):
value = [value]
LOG.debug('Trying to use %s of value %s for node look up'
% (name, value))
LOG.debug('Trying to use %s of value %s for node look up',
(name, value))
value_list = []
for v in value:
value_list.append("name='%s' AND value='%s'" % (name, v))

View File

@ -315,7 +315,7 @@ def _finish_set_ipmi_credentials(ironic, node, node_info, introspection_data,
ironic.node.get_boot_device(node_info.uuid)
except Exception as exc:
LOG.info(_LI('Waiting for credentials update, attempt %(attempt)d '
'current error is %(exc)s') %
'current error is %(exc)s'),
{'attempt': attempt, 'exc': exc},
node_info=node_info, data=introspection_data)
eventlet.greenthread.sleep(_CREDENTIALS_WAIT_PERIOD)
@ -338,7 +338,7 @@ def _finish(ironic, node_info, introspection_data, power_off=True):
if node_info.node().provision_state == 'enroll':
LOG.info(_LI("Failed to power off the node in"
"'enroll' state, ignoring; error was "
"%s") % exc, node_info=node_info,
"%s"), exc, node_info=node_info,
data=introspection_data)
else:
msg = (_('Failed to power off node %(node)s, check '

View File

@ -3,7 +3,7 @@
# process, which may cause wedges in the gate later.
coverage>=4.0 # Apache-2.0
doc8 # Apache-2.0
hacking<0.12,>=0.11.0 # Apache-2.0
hacking<0.13,>=0.12.0 # Apache-2.0
mock>=2.0 # BSD
sphinx!=1.3b1,<1.4,>=1.2.1 # BSD
oslosphinx>=4.7.0 # Apache-2.0

View File

@ -47,6 +47,10 @@ commands = oslo-config-generator --config-file config-generator.conf
[flake8]
max-complexity=15
# [H106] Dont put vim configuration in source files.
# [H203] Use assertIs(Not)None to check for None.
# [H904] Delay string interpolations at logging calls.
enable-extensions=H106,H203,H904
[hacking]
import_exceptions = ironicclient.exceptions,ironic_inspector.common.i18n