use of com.intellij.openapi.application.impl.ApplicationInfoImpl in project intellij-community by JetBrains.
the class Pep8ExternalAnnotator method doAnnotate.
@Nullable
@Override
public Results doAnnotate(State collectedInfo) {
if (collectedInfo == null)
return null;
ArrayList<String> options = Lists.newArrayList();
if (!collectedInfo.ignoredErrors.isEmpty()) {
options.add("--ignore=" + DEFAULT_IGNORED_ERRORS + "," + StringUtil.join(collectedInfo.ignoredErrors, ","));
}
if (collectedInfo.hangClosingBrackets) {
options.add("--hang-closing");
}
options.add("--max-line-length=" + collectedInfo.margin);
options.add("-");
GeneralCommandLine cmd = PythonHelper.PYCODESTYLE.newCommandLine(collectedInfo.interpreterPath, options);
ProcessOutput output = PySdkUtil.getProcessOutput(cmd, new File(collectedInfo.interpreterPath).getParent(), ImmutableMap.of("PYTHONBUFFERED", "1"), 10000, collectedInfo.fileText.getBytes(), false);
Results results = new Results(collectedInfo.level);
if (output.isTimeout()) {
LOG.info("Timeout running pycodestyle.py");
} else if (output.getStderrLines().isEmpty()) {
for (String line : output.getStdoutLines()) {
final Problem problem = parseProblem(line);
if (problem != null) {
results.problems.add(problem);
}
}
} else if (((ApplicationInfoImpl) ApplicationInfo.getInstance()).isEAP()) {
LOG.info("Error running pycodestyle.py: " + output.getStderr());
}
return results;
}
use of com.intellij.openapi.application.impl.ApplicationInfoImpl in project intellij-community by JetBrains.
the class Pep8ExternalAnnotator method parseProblem.
@Nullable
private static Problem parseProblem(String s) {
Matcher m = PROBLEM_PATTERN.matcher(s);
if (m.matches()) {
int line = Integer.parseInt(m.group(1));
int column = Integer.parseInt(m.group(2));
return new Problem(line, column, m.group(3), m.group(4));
}
if (((ApplicationInfoImpl) ApplicationInfo.getInstance()).isEAP()) {
LOG.info("Failed to parse problem line from pycodestyle.py: " + s);
}
return null;
}
use of com.intellij.openapi.application.impl.ApplicationInfoImpl in project intellij-community by JetBrains.
the class StatisticsUploadAssistant method getStatisticsService.
public static StatisticsService getStatisticsService() {
String key = ((ApplicationInfoImpl) ApplicationInfoImpl.getShadowInstance()).getStatisticsServiceKey();
StatisticsService service = key == null ? null : COLLECTOR.findSingle(key);
if (service != null) {
return service;
}
return new RemotelyConfigurableStatisticsService(new StatisticsConnectionService(), new StatisticsHttpClientSender(), new StatisticsUploadAssistant());
}
Aggregations