Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3036
30c81c9e88b8
child 3145
a9de05d4a22f
equal deleted inserted replaced
3058:0a02c433f52d 3060:5883ce99ee12
57 self.counters = {} 57 self.counters = {}
58 58
59 interpreter = Preferences.getDebugger("PythonInterpreter") 59 interpreter = Preferences.getDebugger("PythonInterpreter")
60 if interpreter == "" or not Utilities.isExecutable(interpreter): 60 if interpreter == "" or not Utilities.isExecutable(interpreter):
61 self.errors.append( 61 self.errors.append(
62 (filename, 1, 1, 62 (filename, 1, 1, QCoreApplication.translate(
63 QCoreApplication.translate(
64 "CodeStyleCheckerPy2", 63 "CodeStyleCheckerPy2",
65 "Python2 interpreter not configured."))) 64 "Python2 interpreter not configured.")))
66 return 65 return
67 66
68 checker = os.path.join(getConfig('ericDir'), 67 checker = os.path.join(getConfig('ericDir'),
91 proc.start(interpreter, args) 90 proc.start(interpreter, args)
92 finished = proc.waitForFinished(15000) 91 finished = proc.waitForFinished(15000)
93 if finished: 92 if finished:
94 output = \ 93 output = \
95 str(proc.readAllStandardOutput(), 94 str(proc.readAllStandardOutput(),
96 Preferences.getSystem("IOEncoding"), 95 Preferences.getSystem("IOEncoding"),
97 'replace').splitlines() 96 'replace').splitlines()
98 if output[0] == "ERROR": 97 if output[0] == "ERROR":
99 self.errors.append((filename, 1, 1, output[2])) 98 self.errors.append((filename, 1, 1, output[2]))
100 return 99 return
101 100
102 if output[0] == "NO_PEP8": 101 if output[0] == "NO_PEP8":
131 code, countStr = output[index].split(None, 1) 130 code, countStr = output[index].split(None, 1)
132 self.counters[code] = int(countStr) 131 self.counters[code] = int(countStr)
133 index += 1 132 index += 1
134 else: 133 else:
135 self.errors.append( 134 self.errors.append(
136 (filename, 1, 1, 135 (filename, 1, 1, QCoreApplication.translate(
137 QCoreApplication.translate(
138 "CodeStyleCheckerPy2", 136 "CodeStyleCheckerPy2",
139 "Python2 interpreter did not finish within 15s."))) 137 "Python2 interpreter did not finish within 15s.")))

eric ide

mercurial