Plugins/CheckerPlugins/Pep8/Pep8Checker.py

changeset 1339
913182fdc3dd
parent 1180
566742748d48
child 1509
c0b5e693b0eb
equal deleted inserted replaced
1338:4d0b50ef28cb 1339:913182fdc3dd
136 self.messages = [] 136 self.messages = []
137 self.statistics = {} 137 self.statistics = {}
138 138
139 interpreter = Preferences.getDebugger("PythonInterpreter") 139 interpreter = Preferences.getDebugger("PythonInterpreter")
140 if interpreter == "" or not Utilities.isExecutable(interpreter): 140 if interpreter == "" or not Utilities.isExecutable(interpreter):
141 self.messages.append(filename, "1", "1", 141 self.messages.append((filename, 1, 1,
142 QCoreApplication.translate("Pep8Py2Checker", 142 QCoreApplication.translate("Pep8Py2Checker",
143 "Python2 interpreter not configured.")) 143 "Python2 interpreter not configured.")))
144 return 144 return
145 145
146 checker = os.path.join(getConfig('ericDir'), 146 checker = os.path.join(getConfig('ericDir'),
147 "UtilitiesPython2", "Pep8Checker.py") 147 "UtilitiesPython2", "Pep8Checker.py")
148 148
166 output = \ 166 output = \
167 str(proc.readAllStandardOutput(), 167 str(proc.readAllStandardOutput(),
168 Preferences.getSystem("IOEncoding"), 168 Preferences.getSystem("IOEncoding"),
169 'replace').splitlines() 169 'replace').splitlines()
170 if output[0] == "ERROR": 170 if output[0] == "ERROR":
171 self.messages.append(filename, "1", "1", output[2]) 171 self.messages.append((filename, 1, 1, output[2]))
172 return 172 return
173 173
174 if output[0] == "NO_PEP8": 174 if output[0] == "NO_PEP8":
175 return 175 return
176 176
197 while index < len(output): 197 while index < len(output):
198 code, countStr = output[index].split(None, 1) 198 code, countStr = output[index].split(None, 1)
199 self.statistics[code] = int(countStr) 199 self.statistics[code] = int(countStr)
200 index += 1 200 index += 1
201 else: 201 else:
202 self.messages.append(filename, "1", "1", 202 self.messages.append((filename, 1, 1,
203 QCoreApplication.translate("Pep8Py2Checker", 203 QCoreApplication.translate("Pep8Py2Checker",
204 "Python2 interpreter did not finish within 15s.")) 204 "Python2 interpreter did not finish within 15s.")))

eric ide

mercurial