GUI: Updated parsing of addon output

This commit is contained in:
Daniel Marjamäki 2017-08-15 22:09:55 +02:00
parent b7af13ce63
commit 03b75b54ca
1 changed files with 5 additions and 11 deletions

View File

@ -313,24 +313,18 @@ void CheckThread::parseAddonErrors(QString err, QString tool)
QTextStream in(&err, QIODevice::ReadOnly); QTextStream in(&err, QIODevice::ReadOnly);
while (!in.atEnd()) { while (!in.atEnd()) {
QString line = in.readLine(); QString line = in.readLine();
QRegExp r1("\\[([^:]+):([0-9]+)\\](.*)"); QRegExp r1("\\[([a-zA-Z]?:?[^:]+):([0-9]+)\\][ ][(]([a-z]+)[)]: (.+) \\[([a-zA-Z0-9_\\-\\.]+)\\]");
if (!r1.exactMatch(line)) if (!r1.exactMatch(line))
continue; continue;
const std::string &filename = r1.cap(1).toStdString(); const std::string &filename = r1.cap(1).toStdString();
const int lineNumber = r1.cap(2).toInt(); const int lineNumber = r1.cap(2).toInt();
const std::string severity = r1.cap(3).toStdString();
const std::string message = r1.cap(4).toStdString();
const std::string id = r1.cap(5).toStdString();
std::string message, id;
QRegExp r2("(.*)\\[([a-zA-Z0-9\\-\\._]+)\\]");
if (r2.exactMatch(r1.cap(3))) {
message = r2.cap(1).toStdString();
id = tool.toStdString() + '-' + r2.cap(2).toStdString();
} else {
message = r1.cap(3).toStdString();
id = tool.toStdString();
}
std::list<ErrorLogger::ErrorMessage::FileLocation> callstack; std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
callstack.push_back(ErrorLogger::ErrorMessage::FileLocation(filename, lineNumber)); callstack.push_back(ErrorLogger::ErrorMessage::FileLocation(filename, lineNumber));
ErrorLogger::ErrorMessage errmsg(callstack, filename, Severity::style, message, id, false); ErrorLogger::ErrorMessage errmsg(callstack, filename, Severity::fromString(severity), message, id, false);
mResult.reportErr(errmsg); mResult.reportErr(errmsg);
} }
} }