Merge "Run pylint job under py3"
This commit is contained in:
commit
b711c8da16
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
"""pylint error checking."""
|
"""pylint error checking."""
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
@ -112,6 +110,8 @@ class LintOutput(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def from_line(cls, line):
|
def from_line(cls, line):
|
||||||
m = re.search(r"(\S+):(\d+): \[(\S+)(, \S+)?] (.*)", line)
|
m = re.search(r"(\S+):(\d+): \[(\S+)(, \S+)?] (.*)", line)
|
||||||
|
if m is None:
|
||||||
|
return None
|
||||||
matched = m.groups()
|
matched = m.groups()
|
||||||
filename, lineno, code, message = (matched[0], int(matched[1]),
|
filename, lineno, code, message = (matched[0], int(matched[1]),
|
||||||
matched[2], matched[-1])
|
matched[2], matched[-1])
|
||||||
@ -125,13 +125,15 @@ class LintOutput(object):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_msg_to_dict(cls, msg):
|
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
|
is a unique error identifier, value is a list of LintOutput
|
||||||
"""
|
"""
|
||||||
result = {}
|
result = {}
|
||||||
for line in msg.splitlines():
|
for line in msg.splitlines():
|
||||||
obj = cls.from_line(line)
|
obj = cls.from_line(line)
|
||||||
if obj.is_ignored():
|
if obj is None or obj.is_ignored():
|
||||||
continue
|
continue
|
||||||
key = obj.key()
|
key = obj.key()
|
||||||
if key not in result:
|
if key not in result:
|
||||||
@ -199,8 +201,10 @@ class ErrorKeys(object):
|
|||||||
|
|
||||||
def run_pylint():
|
def run_pylint():
|
||||||
buff = StringIO()
|
buff = StringIO()
|
||||||
reporter = text.ParseableTextReporter(output=buff)
|
reporter = text.TextReporter(output=buff)
|
||||||
args = ["--include-ids=y", "-E", "cinder"]
|
args = [
|
||||||
|
"--msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}'",
|
||||||
|
"-E", "cinder"]
|
||||||
lint.Run(args, reporter=reporter, exit=False)
|
lint.Run(args, reporter=reporter, exit=False)
|
||||||
val = buff.getvalue()
|
val = buff.getvalue()
|
||||||
buff.close()
|
buff.close()
|
||||||
|
3
tox.ini
3
tox.ini
@ -78,9 +78,8 @@ commands =
|
|||||||
{toxinidir}/tools/fast8.sh
|
{toxinidir}/tools/fast8.sh
|
||||||
|
|
||||||
[testenv:pylint]
|
[testenv:pylint]
|
||||||
basepython = python2.7
|
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
pylint==0.26.0
|
pylint==1.9.1
|
||||||
commands = bash tools/lintstack.sh
|
commands = bash tools/lintstack.sh
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user