Skip to content

Commit 16dc8a0

Browse files
committed
GUI: Suppressing addon warnings
1 parent 290791f commit 16dc8a0

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

gui/checkthread.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,16 @@ void CheckThread::parseAddonErrors(QString err, const QString &tool)
360360
const int column = obj["col"].toInt();
361361
const std::string severity = obj["severity"].toString().toStdString();
362362
const std::string message = obj["message"].toString().toStdString();
363-
const std::string id = obj["errorId"].toString().toStdString();
363+
const std::string id = (obj["addon"].toString() + "-" + obj["errorId"].toString()).toStdString();
364364

365365
std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
366366
callstack.push_back(ErrorLogger::ErrorMessage::FileLocation(filename, lineNumber));
367367
callstack.back().col = column;
368368
ErrorLogger::ErrorMessage errmsg(callstack, filename, Severity::fromString(severity), message, id, false);
369+
370+
if (isSuppressed(errmsg.toSuppressionsErrorMessage()))
371+
continue;
372+
369373
mResult.reportErr(errmsg);
370374
}
371375
}
@@ -452,15 +456,9 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
452456
errorMessage.errorId = e.errorId.toStdString();
453457
errorMessage.symbolNames = e.symbolNames.toStdString();
454458

455-
bool isSuppressed = false;
456-
foreach (const Suppressions::Suppression &suppression, mSuppressions) {
457-
if (suppression.isSuppressed(errorMessage)) {
458-
isSuppressed = true;
459-
break;
460-
}
461-
}
462-
if (isSuppressed)
459+
if (isSuppressed(errorMessage))
463460
continue;
461+
464462
std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
465463
foreach (const QErrorPathItem &path, e.errorPath) {
466464
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
473471
}
474472
}
475473

474+
bool CheckThread::isSuppressed(const Suppressions::ErrorMessage &errorMessage) const
475+
{
476+
foreach (const Suppressions::Suppression &suppression, mSuppressions) {
477+
if (suppression.isSuppressed(errorMessage))
478+
return true;
479+
}
480+
return false;
481+
}
482+
476483
QString CheckThread::clangCmd()
477484
{
478485
QString path = QSettings().value(SETTINGS_CLANG_PATH,QString()).toString();

gui/checkthread.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ class CheckThread : public QThread {
147147
void parseAddonErrors(QString err, const QString &tool);
148148
void parseClangErrors(const QString &tool, const QString &file0, QString err);
149149

150+
bool isSuppressed(const Suppressions::ErrorMessage &errorMessage) const;
151+
150152
QStringList mFiles;
151153
bool mAnalyseWholeProgram;
152154
QStringList mAddonsAndTools;

0 commit comments

Comments
 (0)