Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Fix: F601 dictionary key 'cr_to_rp' repeated with different values F841 local variable 'excep' is assigned to but never used F821 undefined name 'excep' E305 expected 2 blank lines after class or function definition, found 1 E731 do not assign a lambda expression, use a def Blacklist: W504 line break after binary operator Update hacking extension for newer flake8 version. Change-Id: I9f0d7b166e285091111c42fe978d29d7dd3bf5db
This commit is contained in:
parent
a7fd12bb19
commit
724f36bd3e
@ -51,7 +51,8 @@ class VMwareDriverException(Exception):
|
|||||||
"""
|
"""
|
||||||
msg_fmt = _("An unknown exception occurred.")
|
msg_fmt = _("An unknown exception occurred.")
|
||||||
|
|
||||||
__str__ = lambda self: self.description
|
def __str__(self):
|
||||||
|
return self.description
|
||||||
|
|
||||||
def __init__(self, message=None, details=None, **kwargs):
|
def __init__(self, message=None, details=None, **kwargs):
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from hacking import core
|
||||||
|
|
||||||
|
|
||||||
_all_log_levels = {'critical', 'error', 'exception', 'info',
|
_all_log_levels = {'critical', 'error', 'exception', 'info',
|
||||||
'warning', 'debug'}
|
'warning', 'debug'}
|
||||||
@ -28,6 +30,7 @@ _log_translation_hint = re.compile(
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@core.flake8ext
|
||||||
def no_translate_logs(logical_line, filename):
|
def no_translate_logs(logical_line, filename):
|
||||||
"""N537 - Don't translate logs.
|
"""N537 - Don't translate logs.
|
||||||
|
|
||||||
@ -46,7 +49,3 @@ def no_translate_logs(logical_line, filename):
|
|||||||
"""
|
"""
|
||||||
if _log_translation_hint.match(logical_line):
|
if _log_translation_hint.match(logical_line):
|
||||||
yield (0, "N537: Log messages should not be translated!")
|
yield (0, "N537: Log messages should not be translated!")
|
||||||
|
|
||||||
|
|
||||||
def factory(register):
|
|
||||||
register(no_translate_logs)
|
|
||||||
|
@ -445,8 +445,8 @@ class DatastoreURL(object):
|
|||||||
httplib.CannotSendHeader) as excep:
|
httplib.CannotSendHeader) as excep:
|
||||||
excep_msg = _("Error occurred while creating HTTP connection "
|
excep_msg = _("Error occurred while creating HTTP connection "
|
||||||
"to write to file with URL = %s.") % str(self)
|
"to write to file with URL = %s.") % str(self)
|
||||||
LOG.exception(excep_msg)
|
LOG.exception(excep_msg)
|
||||||
raise exceptions.VimConnectionException(excep_msg, excep)
|
raise exceptions.VimConnectionException(excep_msg, excep)
|
||||||
|
|
||||||
def get_transfer_ticket(self, session, method):
|
def get_transfer_ticket(self, session, method):
|
||||||
client_factory = session.vim.client.factory
|
client_factory = session.vim.client.factory
|
||||||
|
@ -459,5 +459,6 @@ class SudsLogFilter(logging.Filter):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# Set log filter to mask/truncate vCenter credentials in suds logs.
|
# Set log filter to mask/truncate vCenter credentials in suds logs.
|
||||||
suds.client.log.addFilter(SudsLogFilter())
|
suds.client.log.addFilter(SudsLogFilter())
|
||||||
|
@ -102,11 +102,6 @@ class VimUtilTest(base.TestCase):
|
|||||||
'skip': False,
|
'skip': False,
|
||||||
'selectSet': [rp_to_rp_sel_spec,
|
'selectSet': [rp_to_rp_sel_spec,
|
||||||
rp_to_vm_sel_spec]},
|
rp_to_vm_sel_spec]},
|
||||||
'cr_to_rp': {'type': 'ComputeResource',
|
|
||||||
'path': 'resourcePool',
|
|
||||||
'skip': False,
|
|
||||||
'selectSet': [rp_to_rp_sel_spec,
|
|
||||||
rp_to_vm_sel_spec]},
|
|
||||||
'ccr_to_h': {'type': 'ClusterComputeResource',
|
'ccr_to_h': {'type': 'ClusterComputeResource',
|
||||||
'path': 'host',
|
'path': 'host',
|
||||||
'skip': False,
|
'skip': False,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# process, which may cause wedges in the gate later.
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
# Hacking already pins down pep8, pyflakes and flake8
|
# Hacking already pins down pep8, pyflakes and flake8
|
||||||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
hacking>=3.0,<3.1.0 # Apache-2.0
|
||||||
|
|
||||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||||
mock>=2.0.0 # BSD
|
mock>=2.0.0 # BSD
|
||||||
|
8
tox.ini
8
tox.ini
@ -44,14 +44,18 @@ commands = {posargs}
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
show-source = True
|
show-source = True
|
||||||
ignore = H405
|
ignore = H405,W504
|
||||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,__init__.py
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,__init__.py
|
||||||
|
|
||||||
[hacking]
|
[hacking]
|
||||||
import_exceptions =
|
import_exceptions =
|
||||||
oslo_vmware.tests.base
|
oslo_vmware.tests.base
|
||||||
tests.base
|
tests.base
|
||||||
local-check-factory = oslo_vmware.hacking.checks.factory
|
|
||||||
|
[flake8:local-plugins]
|
||||||
|
extension =
|
||||||
|
N537 = checks:no_translate_logs
|
||||||
|
paths = ./oslo_vmware/hacking
|
||||||
|
|
||||||
[testenv:releasenotes]
|
[testenv:releasenotes]
|
||||||
whitelist_externals = rm
|
whitelist_externals = rm
|
||||||
|
Loading…
Reference in New Issue
Block a user