summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-07-23 22:56:12 +0000
committerGerrit Code Review <review@openstack.org>2018-07-23 22:56:12 +0000
commit93dae2a82226d572e79c8cc87ab976c1eb03757b (patch)
tree0189e8c536450116b02732ff28460dcb1cfb8cee
parent7e1db552456f5963632445ee91e63fc74ed12923 (diff)
parent258586fb184b9db905e883f21ff636ee3360a992 (diff)
downloadpython-cinderclient-93dae2a82226d572e79c8cc87ab976c1eb03757b.tar.gz
Merge "Update pylint to work with python 3"
-rw-r--r--.gitignore4
-rw-r--r--cinderclient/client.py2
-rwxr-xr-xtools/lintstack.py16
-rw-r--r--tox.ini2
4 files changed, 16 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 92d8927..9d12a57 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,7 @@ build
dist
cinderclient/versioninfo
python_cinderclient.egg-info
+
+# pylint files
+tools/lintstack.head.py
+tools/pylint_exceptions
diff --git a/cinderclient/client.py b/cinderclient/client.py
index 9f6febe..c4626a9 100644
--- a/cinderclient/client.py
+++ b/cinderclient/client.py
@@ -69,7 +69,7 @@ REQ_ID_HEADER = 'X-OpenStack-Request-ID'
# tell keystoneclient that we can ignore the /v1|v2/{project_id} component of
# the service catalog when doing discovery lookups
for svc in ('volume', 'volumev2', 'volumev3'):
- discover.add_catalog_discover_hack(svc, re.compile('/v[12]/\w+/?$'), '/')
+ discover.add_catalog_discover_hack(svc, re.compile(r'/v[12]/\w+/?$'), '/')
def get_server_version(url):
diff --git a/tools/lintstack.py b/tools/lintstack.py
index 34ca056..1ae34d7 100755
--- a/tools/lintstack.py
+++ b/tools/lintstack.py
@@ -16,8 +16,6 @@
"""pylint error checking."""
-from __future__ import print_function
-
import json
import re
import sys
@@ -70,6 +68,8 @@ class LintOutput(object):
@classmethod
def from_line(cls, line):
m = re.search(r"(\S+):(\d+): \[(\S+)(, \S+)?] (.*)", line)
+ if m is None:
+ return None
matched = m.groups()
filename, lineno, code, message = (matched[0], int(matched[1]),
matched[2], matched[-1])
@@ -83,13 +83,15 @@ class LintOutput(object):
@classmethod
def from_msg_to_dict(cls, msg):
- """From the output of pylint msg, to a dict, where each key
+ """Convert pylint output to a dict.
+
+ From the output of pylint msg, to a dict, where each key
is a unique error identifier, value is a list of LintOutput
"""
result = {}
for line in msg.splitlines():
obj = cls.from_line(line)
- if obj.is_ignored():
+ if obj is None or obj.is_ignored():
continue
key = obj.key()
if key not in result:
@@ -147,8 +149,10 @@ class ErrorKeys(object):
def run_pylint():
buff = StringIO()
- reporter = text.ParseableTextReporter(output=buff)
- args = ["--include-ids=y", "-E", "cinderclient"]
+ reporter = text.TextReporter(output=buff)
+ args = [
+ "--msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}'",
+ "-E", "cinderclient"]
lint.Run(args, reporter=reporter, exit=False)
val = buff.getvalue()
buff.close()
diff --git a/tox.ini b/tox.ini
index 58c33c1..0adc492 100644
--- a/tox.ini
+++ b/tox.ini
@@ -33,7 +33,7 @@ basepython = python3
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
-r{toxinidir}/requirements.txt
- pylint==0.26.0
+ pylint==1.9.1
commands = bash tools/lintstack.sh
whitelist_externals = bash