summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSean McGinnis <sean.mcginnis@gmail.com>2018-07-23 13:55:36 -0500
committerSean McGinnis <sean.mcginnis@gmail.com>2018-07-23 14:05:13 -0500
commit258586fb184b9db905e883f21ff636ee3360a992 (patch)
tree9e565ee9ddc8d1dc57a66a7686b07e5a7ead6e97 /tools
parent4536b2fb9f8d896fc5b46bd5cfe7ca19167ce5bc (diff)
downloadpython-cinderclient-258586fb184b9db905e883f21ff636ee3360a992.tar.gz
Update pylint to work with python 3
The pylint job was switched over to run under python 3, but the job is not voting and it was apparently missed that the conversion was causing it to fail. This updates the version of pylint to one that is actually supported by python 3 and makes tweaks to our script to for the minor changes between versions. Single character change to get rid of the more strict py3 regex string escape character format. Change-Id: I93124b62c5ee177815457b32f55f5453fc3d387e Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/lintstack.py16
1 files changed, 10 insertions, 6 deletions
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()