Browse Source

Default pylint to run using python3

Updates the pylint and lint jobs to run under python3 by
changing the target python and updating the version of
pylint used.

Change-Id: Ie0ac158674fb22054b80864d33d9d7ecc82e3b36
Closes-bug: #1673824
Sean McGinnis 10 months ago
parent
commit
4c943fbcb2
2 changed files with 11 additions and 9 deletions
  1. 7
    5
      tools/lintstack.py
  2. 4
    4
      tox.ini

+ 7
- 5
tools/lintstack.py View File

@@ -17,8 +17,6 @@
17 17
 
18 18
 """pylint error checking."""
19 19
 
20
-from __future__ import print_function
21
-
22 20
 import json
23 21
 import re
24 22
 import sys
@@ -61,6 +59,8 @@ class LintOutput(object):
61 59
     @classmethod
62 60
     def from_line(cls, line):
63 61
         m = re.search(r"(\S+):(\d+): \[(\S+)(, \S+)?] (.*)", line)
62
+        if m is None:
63
+            return None
64 64
         matched = m.groups()
65 65
         filename, lineno, code, message = (matched[0], int(matched[1]),
66 66
                                            matched[2], matched[-1])
@@ -82,7 +82,7 @@ class LintOutput(object):
82 82
         result = {}
83 83
         for line in msg.splitlines():
84 84
             obj = cls.from_line(line)
85
-            if obj.is_ignored():
85
+            if obj is None or obj.is_ignored():
86 86
                 continue
87 87
             key = obj.key()
88 88
             if key not in result:
@@ -138,8 +138,10 @@ class ErrorKeys(object):
138 138
 
139 139
 def run_pylint():
140 140
     buff = six.StringIO()
141
-    reporter = text.ParseableTextReporter(output=buff)
142
-    args = ["--include-ids=y", "-E", "manila"]
141
+    reporter = text.TextReporter(output=buff)
142
+    args = [
143
+        "--msg-template='{path}:{line}: [{msg_id}i({symbol}), {obj}] {msg}'",
144
+        "-E", "manila"]
143 145
     lint.Run(args, reporter=reporter, exit=False)
144 146
     val = buff.getvalue()
145 147
     buff.close()

+ 4
- 4
tox.ini View File

@@ -96,16 +96,16 @@ commands =
96 96
   {toxinidir}/tools/fast8.sh
97 97
 
98 98
 [testenv:pylint]
99
-basepython = python2.7
99
+basepython = python3
100 100
 deps = -r{toxinidir}/requirements.txt
101
-       pylint==0.26.0
101
+       pylint==1.9.0
102 102
 whitelist_externals = bash
103 103
 commands = bash tools/lintstack.sh
104 104
 
105 105
 [testenv:lint]
106
-basepython = python2.7
106
+basepython = python3
107 107
 deps = -r{toxinidir}/requirements.txt
108
-       pylint==0.26.0
108
+       pylint==1.9.0
109 109
 commands = python tools/lintstack.py check
110 110
 
111 111
 [testenv:api-ref]

Loading…
Cancel
Save