| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d9f5fc0 commit fe537a7
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -239,6 +239,11 @@ bool ResultsTree::addErrorItem(const ErrorItem& errorItem) | |||
| 239 | 239 | if (errorItem.errorPath.isEmpty()) | |
| 240 | 240 | return false; | |
| 241 | 241 | ||
| 242 | + const QString s = errorItem.toString(); | ||
| 243 | + if (mErrorList.contains(s)) | ||
| 244 | + return false; | ||
| 245 | + mErrorList.append(s); | ||
| 246 | + | ||
| 242 | 247 | QSharedPointer<ErrorItem> errorItemPtr{new ErrorItem(errorItem)}; | |
| 243 | 248 | ||
| 244 | 249 | if (mReportType != ReportType::normal) { | |
@@ -393,6 +398,8 @@ ResultItem *ResultsTree::findFileItem(const QString &name) const | |||
| 393 | 398 | ||
| 394 | 399 | void ResultsTree::clear() | |
| 395 | 400 | { | |
| 401 | + mErrorList.clear(); | ||
| 402 | + | ||
| 396 | 403 | mModel->removeRows(0, mModel->rowCount()); | |
| 397 | 404 | ||
| 398 | 405 | if (const ProjectFile *activeProject = ProjectFile::getActiveProject()) { | |
@@ -419,6 +426,7 @@ void ResultsTree::clear(const QString &filename) | |||
| 419 | 426 | if (stripped == fileItem->text() || | |
| 420 | 427 | filename == fileItem->errorItem->file0) { | |
| 421 | 428 | mModel->removeRow(i); | |
| 429 | + mErrorList.removeAll(fileItem->errorItem->toString()); | ||
| 422 | 430 | break; | |
| 423 | 431 | } | |
| 424 | 432 | } | |
@@ -436,6 +444,7 @@ void ResultsTree::clearRecheckFile(const QString &filename) | |||
| 436 | 444 | storedfile = ((!mCheckPath.isEmpty() && storedfile.startsWith(mCheckPath)) ? storedfile.mid(mCheckPath.length() + 1) : storedfile); | |
| 437 | 445 | if (actualfile == storedfile) { | |
| 438 | 446 | mModel->removeRow(i); | |
| 447 | + mErrorList.removeAll(fileItem->errorItem->toString()); | ||
| 439 | 448 | break; | |
| 440 | 449 | } | |
| 441 | 450 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -568,6 +568,9 @@ protected slots: | |||
| 568 | 568 | ||
| 569 | 569 | QStringList mHiddenMessageId; | |
| 570 | 570 | ||
| 571 | + // List of existing errors so we can avoid duplicates | ||
| 572 | + QStringList mErrorList; | ||
| 573 | + | ||
| 571 | 574 | QItemSelectionModel* mSelectionModel{}; | |
| 572 | 575 | ThreadHandler *mThread{}; | |
| 573 | 576 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -134,6 +134,19 @@ void TestResultsTree::test1() const | |||
| 134 | 134 | QCOMPARE(tree.isRowHidden(0,QModelIndex()), false); // Show item | |
| 135 | 135 | } | |
| 136 | 136 | ||
| 137 | + void TestResultsTree::duplicateResults() const | ||
| 138 | + { | ||
| 139 | + // #14359 - filter out duplicate warnings | ||
| 140 | + ResultsTree tree(nullptr); | ||
| 141 | + | ||
| 142 | + ErrorItem errorItem; | ||
| 143 | + errorItem.summary = errorItem.message = "test"; | ||
| 144 | + errorItem.severity = Severity::error; | ||
| 145 | + errorItem.errorPath << QErrorPathItem(); | ||
| 146 | + QVERIFY(tree.addErrorItem(errorItem)); | ||
| 147 | + QVERIFY(!tree.addErrorItem(errorItem)); | ||
| 148 | + } | ||
| 149 | + | ||
| 137 | 150 | static QErrorPathItem createErrorPathItem(QString file, int line, int column, QString info) { | |
| 138 | 151 | QErrorPathItem ret; | |
| 139 | 152 | ret.file = std::move(file); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,7 @@ class TestResultsTree : public QObject { | |||
| 23 | 23 | ||
| 24 | 24 | private slots: | |
| 25 | 25 | void test1() const; | |
| 26 | + void duplicateResults() const; | ||
| 26 | 27 | void multiLineResult() const; | |
| 27 | 28 | void resultsInSameFile() const; | |
| 28 | 29 | void testReportType() const; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments