}
messageToIgnore = prefs.getRequiredMessageToIgnore(IAnalysisPreferences.TYPE_PEP8);
String[] pep8CommandLine = AnalysisPreferencesPage.getPep8CommandLine();
FastStringBuffer args = new FastStringBuffer(pep8CommandLine.length * 20);
for (String string : pep8CommandLine) {
args.append(',').append("r'").append(string).append('\'');
}
String pep8Location = AnalysisPreferencesPage.getPep8Location();
File pep8Loc = new File(pep8Location);
if (!pep8Loc.exists()) {
Log.log("Specified location for pep8.py does not exist (" + pep8Location + ").");
return messages;
}
this.prefs = prefs;
this.document = document;
//It's important that the interpreter is created in the Thread and not outside the thread (otherwise
//it may be that the output ends up being shared, which is not what we want.)
boolean useConsole = AnalysisPreferencesPage.useConsole();
IPythonInterpreter interpreter = JythonPlugin.newPythonInterpreter(useConsole, false);
if (!useConsole) {
interpreter.setErr(NullOutputStream.singleton);
interpreter.setOut(NullOutputStream.singleton);
}
String file = StringUtils.replaceAllSlashes(module.getFile().getAbsolutePath());
interpreter.set("visitor", this);
List<String> splitInLines = StringUtils.splitInLines(document.get());
interpreter.set("lines", splitInLines);
PyObject tempPep8 = pep8;
if (tempPep8 != null) {
interpreter.set("pep8", tempPep8);
} else {
interpreter.set("pep8", Py.None);
}
String formatted = com.aptana.shared_core.string.StringUtils.format(EXECUTE_PEP8, file, args.toString(),
StringUtils.replaceAllSlashes(pep8Loc.getParentFile().getAbsolutePath()), //put the parent dir of pep8.py in the pythonpath.
file);
interpreter.exec(formatted);
if (pep8 == null) {
synchronized (lock) {