GUI: Suppressing addon warnings

This commit is contained in:
Daniel Marjamäki 2019-08-09 19:00:09 +02:00
parent 290791f54f
commit 16dc8a0540
2 changed files with 18 additions and 9 deletions

View File

@ -360,12 +360,16 @@ void CheckThread::parseAddonErrors(QString err, const QString &tool)
const int column = obj["col"].toInt(); const int column = obj["col"].toInt();
const std::string severity = obj["severity"].toString().toStdString(); const std::string severity = obj["severity"].toString().toStdString();
const std::string message = obj["message"].toString().toStdString(); const std::string message = obj["message"].toString().toStdString();
const std::string id = obj["errorId"].toString().toStdString(); const std::string id = (obj["addon"].toString() + "-" + obj["errorId"].toString()).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));
callstack.back().col = column; callstack.back().col = column;
ErrorLogger::ErrorMessage errmsg(callstack, filename, Severity::fromString(severity), message, id, false); ErrorLogger::ErrorMessage errmsg(callstack, filename, Severity::fromString(severity), message, id, false);
if (isSuppressed(errmsg.toSuppressionsErrorMessage()))
continue;
mResult.reportErr(errmsg); mResult.reportErr(errmsg);
} }
} }
@ -452,15 +456,9 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
errorMessage.errorId = e.errorId.toStdString(); errorMessage.errorId = e.errorId.toStdString();
errorMessage.symbolNames = e.symbolNames.toStdString(); errorMessage.symbolNames = e.symbolNames.toStdString();
bool isSuppressed = false; if (isSuppressed(errorMessage))
foreach (const Suppressions::Suppression &suppression, mSuppressions) {
if (suppression.isSuppressed(errorMessage)) {
isSuppressed = true;
break;
}
}
if (isSuppressed)
continue; continue;
std::list<ErrorLogger::ErrorMessage::FileLocation> callstack; std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
foreach (const QErrorPathItem &path, e.errorPath) { foreach (const QErrorPathItem &path, e.errorPath) {
callstack.push_back(ErrorLogger::ErrorMessage::FileLocation(path.file.toStdString(), path.info.toStdString(), path.line)); callstack.push_back(ErrorLogger::ErrorMessage::FileLocation(path.file.toStdString(), path.info.toStdString(), path.line));
@ -473,6 +471,15 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
} }
} }
bool CheckThread::isSuppressed(const Suppressions::ErrorMessage &errorMessage) const
{
foreach (const Suppressions::Suppression &suppression, mSuppressions) {
if (suppression.isSuppressed(errorMessage))
return true;
}
return false;
}
QString CheckThread::clangCmd() QString CheckThread::clangCmd()
{ {
QString path = QSettings().value(SETTINGS_CLANG_PATH,QString()).toString(); QString path = QSettings().value(SETTINGS_CLANG_PATH,QString()).toString();

View File

@ -147,6 +147,8 @@ private:
void parseAddonErrors(QString err, const QString &tool); void parseAddonErrors(QString err, const QString &tool);
void parseClangErrors(const QString &tool, const QString &file0, QString err); void parseClangErrors(const QString &tool, const QString &file0, QString err);
bool isSuppressed(const Suppressions::ErrorMessage &errorMessage) const;
QStringList mFiles; QStringList mFiles;
bool mAnalyseWholeProgram; bool mAnalyseWholeProgram;
QStringList mAddonsAndTools; QStringList mAddonsAndTools;