Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions gui/resultstree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ bool ResultsTree::addErrorItem(const ErrorItem& errorItem)
if (errorItem.errorPath.isEmpty())
return false;

const QString s = errorItem.toString();
if (mErrorList.contains(s))
return false;
mErrorList.append(s);

QSharedPointer<ErrorItem> errorItemPtr{new ErrorItem(errorItem)};

if (mReportType != ReportType::normal) {
Expand Down Expand Up @@ -393,6 +398,8 @@ ResultItem *ResultsTree::findFileItem(const QString &name) const

void ResultsTree::clear()
{
mErrorList.clear();

mModel->removeRows(0, mModel->rowCount());

if (const ProjectFile *activeProject = ProjectFile::getActiveProject()) {
Expand All @@ -419,6 +426,7 @@ void ResultsTree::clear(const QString &filename)
if (stripped == fileItem->text() ||
filename == fileItem->errorItem->file0) {
mModel->removeRow(i);
mErrorList.removeAll(fileItem->errorItem->toString());
break;
}
}
Expand All @@ -436,6 +444,7 @@ void ResultsTree::clearRecheckFile(const QString &filename)
storedfile = ((!mCheckPath.isEmpty() && storedfile.startsWith(mCheckPath)) ? storedfile.mid(mCheckPath.length() + 1) : storedfile);
if (actualfile == storedfile) {
mModel->removeRow(i);
mErrorList.removeAll(fileItem->errorItem->toString());
break;
}
}
Expand Down
3 changes: 3 additions & 0 deletions gui/resultstree.h
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,9 @@ protected slots:

QStringList mHiddenMessageId;

// List of existing errors so we can avoid duplicates
QStringList mErrorList;

QItemSelectionModel* mSelectionModel{};
ThreadHandler *mThread{};

Expand Down
13 changes: 13 additions & 0 deletions gui/test/resultstree/testresultstree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ void TestResultsTree::test1() const
QCOMPARE(tree.isRowHidden(0,QModelIndex()), false); // Show item
}

void TestResultsTree::duplicateResults() const
{
// #14359 - filter out duplicate warnings
ResultsTree tree(nullptr);

ErrorItem errorItem;
errorItem.summary = errorItem.message = "test";
errorItem.severity = Severity::error;
errorItem.errorPath << QErrorPathItem();
QVERIFY(tree.addErrorItem(errorItem));
QVERIFY(!tree.addErrorItem(errorItem));
}

static QErrorPathItem createErrorPathItem(QString file, int line, int column, QString info) {
QErrorPathItem ret;
ret.file = std::move(file);
Expand Down
1 change: 1 addition & 0 deletions gui/test/resultstree/testresultstree.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TestResultsTree : public QObject {

private slots:
void test1() const;
void duplicateResults() const;
void multiLineResult() const;
void resultsInSameFile() const;
void testReportType() const;
Expand Down
Loading