Plugins/CheckerPlugins/Pep8/Pep8Checker.py

branch
5_1_x
changeset 1340
142ad6decc3a
parent 1178
2d22b5ce9384
child 1510
e75ecf2bd9dd
equal deleted inserted replaced
1336:d8e473d7e443 1340:142ad6decc3a
135 self.messages = [] 135 self.messages = []
136 self.statistics = {} 136 self.statistics = {}
137 137
138 interpreter = Preferences.getDebugger("PythonInterpreter") 138 interpreter = Preferences.getDebugger("PythonInterpreter")
139 if interpreter == "" or not Utilities.isExecutable(interpreter): 139 if interpreter == "" or not Utilities.isExecutable(interpreter):
140 self.messages.append(filename, "1", "1", 140 self.messages.append((filename, 1, 1,
141 QCoreApplication.translate("Pep8Py2Checker", 141 QCoreApplication.translate("Pep8Py2Checker",
142 "Python2 interpreter not configured.")) 142 "Python2 interpreter not configured.")))
143 return 143 return
144 144
145 checker = os.path.join(getConfig('ericDir'), 145 checker = os.path.join(getConfig('ericDir'),
146 "UtilitiesPython2", "Pep8Checker.py") 146 "UtilitiesPython2", "Pep8Checker.py")
147 147
165 output = \ 165 output = \
166 str(proc.readAllStandardOutput(), 166 str(proc.readAllStandardOutput(),
167 Preferences.getSystem("IOEncoding"), 167 Preferences.getSystem("IOEncoding"),
168 'replace').splitlines() 168 'replace').splitlines()
169 if output[0] == "ERROR": 169 if output[0] == "ERROR":
170 self.messages.append(filename, "1", "1", output[2]) 170 self.messages.append((filename, 1, 1, output[2]))
171 return 171 return
172 172
173 if output[0] == "NO_PEP8": 173 if output[0] == "NO_PEP8":
174 return 174 return
175 175
196 while index < len(output): 196 while index < len(output):
197 code, countStr = output[index].split(None, 1) 197 code, countStr = output[index].split(None, 1)
198 self.statistics[code] = int(countStr) 198 self.statistics[code] = int(countStr)
199 index += 1 199 index += 1
200 else: 200 else:
201 self.messages.append(filename, "1", "1", 201 self.messages.append((filename, 1, 1,
202 QCoreApplication.translate("Pep8Py2Checker", 202 QCoreApplication.translate("Pep8Py2Checker",
203 "Python2 interpreter did not finish within 15s.")) 203 "Python2 interpreter did not finish within 15s.")))

eric ide

mercurial