Updating flake8 version for distributed cloud

This also fixes the linters target which fails when yamllint
does not find any inputs.

Most new failures are being suppressed for now, and will be
cleaned up by future submissions.

Story: 2004515
Task: 38739
Change-Id: I8bddba83408be19a487837e326c86432579c50db
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
This commit is contained in:
Al Bailey 2020-01-21 16:31:33 -06:00 committed by Al Bailey
parent ddeda0fa0e
commit bde6982ded
5 changed files with 40 additions and 8 deletions

View File

@ -265,7 +265,7 @@ class SubcloudsController(object):
if 'nexthop_gateway' in install_values:
try:
gateway_ip = IPAddress(install_values['nexthop_gateway'])
except AddrFormatError:
except AddrFormatError as e:
LOG.exception(e)
pecan.abort(400, _("nexthop_gateway address invalid: %s") % e)
if gateway_ip.version != ip_version:

View File

@ -1078,7 +1078,7 @@ class PatchOrchThread(threading.Thread):
try:
ks_client = self.get_ks_client(region)
except (keystone_exceptions.EndpointNotFound, IndexError) as e:
except (keystone_exceptions.EndpointNotFound, IndexError):
message = ("Identity endpoint for subcloud: %s not found." %
region)
LOG.error(message)

View File

@ -80,7 +80,7 @@ class VolumeSyncThread(SyncThread):
func_name = request.orch_job.operation_type + \
"_" + rsrc.resource_type
getattr(self, func_name)(request, rsrc)
except keystone_exceptions.EndpointNotFound as e:
except keystone_exceptions.EndpointNotFound:
# Cinder is optional in the subcloud, so this isn't considered
# an error.
LOG.info("sync_volume_resource: {} does not have a volume "
@ -247,7 +247,7 @@ class VolumeSyncThread(SyncThread):
.format(self.subcloud_engine.subcloud.region_name,
str(e)), extra=self.log_extra)
return None
except keystone_exceptions.EndpointNotFound as e:
except keystone_exceptions.EndpointNotFound:
LOG.info("get_quota_class: subcloud {} does not have a volume "
"endpoint in keystone"
.format(self.subcloud_engine.subcloud.region_name),

View File

@ -66,7 +66,9 @@ commands = oslo_debug_helper {posargs}
[testenv:pep8]
basepython = python3
deps = hacking<0.11,>=0.10.2
deps = hacking>=1.1.0,<=2.0.0
pycodestyle>=2.0.0
flake8-bugbear
commands = flake8
[testenv:venv]
@ -138,9 +140,27 @@ basepython = python3
commands = oslo_debug_helper {posargs}
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125,H233
# Suppressed flake8 codes
# W503 line break before binary operator
# W504 line break after binary operator
# W605 invalid escape sequence
# E117 over-indented
# E123 closing bracket does not match indentation of opening bracket's line
# E125 continuation line with same indent as next logical line
# E305 expected 2 blank lines after class or function definition
# E402 module level import not at top of file
# E501 line too long
# E731 do not assign a lambda expression, use a def
# -B- codes are bugbear errors
# B005 Using .strip() with multi-character strings is misleading the reader.
# B006 Do not use mutable data structures for argument defaults.
# B007 Loop control variable not used within the loop body.
# B009 Do not call getattr with a constant attribute value,
# B306 `BaseException.message` has been deprecated as of Python 2.6 and is removed in Python 3
ignore = W503,W504,W605,
E117,E123,E125,E305,E402,E501,E731,
B005,B006,B007,B009,B306
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
@ -160,3 +180,15 @@ deps = {[testenv]deps}
commands =
pylint {posargs} dcmanager dcorch --rcfile=./pylint.rc
[testenv:linters]
basepython = python3
# bashate ignore:
# E006 - accept long lines
# E040 - false positive on |& syntax (new in bash 4)
whitelist_externals = bash
commands =
bash -c "find {toxinidir} \
\( -name .tox -prune \) \
-o -type f -name '*.yaml' \
-print0 | xargs -r -0 yamllint"

View File

@ -47,7 +47,7 @@ commands =
bash -c "find {toxinidir} \
\( -name .tox -prune \) \
-o -type f -name '*.yaml' \
-print0 | xargs -0 yamllint"
-print0 | xargs -r -0 yamllint"
[testenv:docs]
basepython = python3