GUI: Suppressing results
This commit is contained in:
parent
5de64d6755
commit
ad82f49ae2
|
@ -371,11 +371,16 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
|
||||||
foreach (const ErrorItem &e, errorItems) {
|
foreach (const ErrorItem &e, errorItems) {
|
||||||
if (e.errorPath.isEmpty())
|
if (e.errorPath.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
if (mSuppressions.contains(e.errorId))
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
ErrorLogger::ErrorMessage errmsg(callstack, file0.toStdString(), errorItem.severity, errorItem.message.toStdString(), errorItem.errorId.toStdString(), false);
|
const std::string f0 = file0.toStdString();
|
||||||
|
const std::string msg = e.message.toStdString();
|
||||||
|
const std::string id = e.errorId.toStdString();
|
||||||
|
ErrorLogger::ErrorMessage errmsg(callstack, f0, errorItem.severity, msg, id, false);
|
||||||
mResult.reportErr(errmsg);
|
mResult.reportErr(errmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,10 @@ public:
|
||||||
mClangPath = p;
|
mClangPath = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSuppressions(const QStringList s) {
|
||||||
|
mSuppressions = s;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief method that is run in a thread
|
* @brief method that is run in a thread
|
||||||
*
|
*
|
||||||
|
@ -127,6 +131,7 @@ private:
|
||||||
QString mVsIncludePaths;
|
QString mVsIncludePaths;
|
||||||
QString mDataDir;
|
QString mDataDir;
|
||||||
QString mClangPath;
|
QString mClangPath;
|
||||||
|
QStringList mSuppressions;
|
||||||
};
|
};
|
||||||
/// @}
|
/// @}
|
||||||
#endif // CHECKTHREAD_H
|
#endif // CHECKTHREAD_H
|
||||||
|
|
|
@ -127,6 +127,7 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
|
||||||
connect(mUI.mResults, &ResultsView::resultsHidden, mUI.mActionShowHidden, &QAction::setEnabled);
|
connect(mUI.mResults, &ResultsView::resultsHidden, mUI.mActionShowHidden, &QAction::setEnabled);
|
||||||
connect(mUI.mResults, &ResultsView::checkSelected, this, &MainWindow::performSelectedFilesCheck);
|
connect(mUI.mResults, &ResultsView::checkSelected, this, &MainWindow::performSelectedFilesCheck);
|
||||||
connect(mUI.mResults, &ResultsView::tagged, this, &MainWindow::tagged);
|
connect(mUI.mResults, &ResultsView::tagged, this, &MainWindow::tagged);
|
||||||
|
connect(mUI.mResults, &ResultsView::suppressIds, this, &MainWindow::suppressIds);
|
||||||
connect(mUI.mMenuView, &QMenu::aboutToShow, this, &MainWindow::aboutToShowViewMenu);
|
connect(mUI.mMenuView, &QMenu::aboutToShow, this, &MainWindow::aboutToShowViewMenu);
|
||||||
|
|
||||||
// File menu
|
// File menu
|
||||||
|
@ -452,6 +453,7 @@ void MainWindow::doAnalyzeProject(ImportProject p)
|
||||||
clangPath = "C:/Program Files/LLVM/bin";
|
clangPath = "C:/Program Files/LLVM/bin";
|
||||||
}
|
}
|
||||||
mThread->setClangPath(clangPath);
|
mThread->setClangPath(clangPath);
|
||||||
|
mThread->setSuppressions(mProjectFile->getSuppressions());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
mThread->setProject(p);
|
mThread->setProject(p);
|
||||||
|
@ -1690,3 +1692,16 @@ void MainWindow::tagged()
|
||||||
if (!lastResults.isEmpty())
|
if (!lastResults.isEmpty())
|
||||||
mUI.mResults->save(lastResults, Report::XMLV2);
|
mUI.mResults->save(lastResults, Report::XMLV2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::suppressIds(QStringList ids)
|
||||||
|
{
|
||||||
|
if (mProjectFile) {
|
||||||
|
QStringList suppressions = mProjectFile->getSuppressions();
|
||||||
|
foreach (QString s, ids) {
|
||||||
|
if (!suppressions.contains(s))
|
||||||
|
suppressions << s;
|
||||||
|
}
|
||||||
|
mProjectFile->setSuppressions(suppressions);
|
||||||
|
mProjectFile->write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -224,6 +224,9 @@ protected slots:
|
||||||
/** Some results were tagged */
|
/** Some results were tagged */
|
||||||
void tagged();
|
void tagged();
|
||||||
|
|
||||||
|
/** Suppress error ids */
|
||||||
|
void suppressIds(QStringList ids);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/** Get filename for last results */
|
/** Get filename for last results */
|
||||||
|
|
|
@ -602,6 +602,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
||||||
QAction *copymessageid = new QAction(tr("Copy message id"), &menu);
|
QAction *copymessageid = new QAction(tr("Copy message id"), &menu);
|
||||||
QAction *hide = new QAction(tr("Hide"), &menu);
|
QAction *hide = new QAction(tr("Hide"), &menu);
|
||||||
QAction *hideallid = new QAction(tr("Hide all with id"), &menu);
|
QAction *hideallid = new QAction(tr("Hide all with id"), &menu);
|
||||||
|
QAction *suppress = new QAction(tr("Suppress selected id(s)"), &menu);
|
||||||
QAction *opencontainingfolder = new QAction(tr("Open containing folder"), &menu);
|
QAction *opencontainingfolder = new QAction(tr("Open containing folder"), &menu);
|
||||||
|
|
||||||
if (multipleSelection) {
|
if (multipleSelection) {
|
||||||
|
@ -624,6 +625,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
||||||
menu.addAction(copymessageid);
|
menu.addAction(copymessageid);
|
||||||
menu.addAction(hide);
|
menu.addAction(hide);
|
||||||
menu.addAction(hideallid);
|
menu.addAction(hideallid);
|
||||||
|
menu.addAction(suppress);
|
||||||
menu.addAction(opencontainingfolder);
|
menu.addAction(opencontainingfolder);
|
||||||
|
|
||||||
connect(recheckSelectedFiles, SIGNAL(triggered()), this, SLOT(recheckSelectedFiles()));
|
connect(recheckSelectedFiles, SIGNAL(triggered()), this, SLOT(recheckSelectedFiles()));
|
||||||
|
@ -633,6 +635,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
||||||
connect(copymessageid, SIGNAL(triggered()), this, SLOT(copyMessageId()));
|
connect(copymessageid, SIGNAL(triggered()), this, SLOT(copyMessageId()));
|
||||||
connect(hide, SIGNAL(triggered()), this, SLOT(hideResult()));
|
connect(hide, SIGNAL(triggered()), this, SLOT(hideResult()));
|
||||||
connect(hideallid, SIGNAL(triggered()), this, SLOT(hideAllIdResult()));
|
connect(hideallid, SIGNAL(triggered()), this, SLOT(hideAllIdResult()));
|
||||||
|
connect(suppress, SIGNAL(triggered()), this, SLOT(suppressSelectedIds()));
|
||||||
connect(opencontainingfolder, SIGNAL(triggered()), this, SLOT(openContainingFolder()));
|
connect(opencontainingfolder, SIGNAL(triggered()), this, SLOT(openContainingFolder()));
|
||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
@ -936,6 +939,43 @@ void ResultsTree::hideAllIdResult()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResultsTree::suppressSelectedIds()
|
||||||
|
{
|
||||||
|
if (!mSelectionModel)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QModelIndexList selectedRows = mSelectionModel->selectedRows();
|
||||||
|
QSet<QString> selectedIds;
|
||||||
|
foreach (QModelIndex index, selectedRows) {
|
||||||
|
QStandardItem *item = mModel.itemFromIndex(index);
|
||||||
|
if (!item->parent())
|
||||||
|
continue;
|
||||||
|
if (item->parent()->parent())
|
||||||
|
item = item->parent();
|
||||||
|
QVariantMap data = item->data().toMap();
|
||||||
|
if (!data.contains("id"))
|
||||||
|
continue;
|
||||||
|
selectedIds << data["id"].toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete all errors with selected message Ids
|
||||||
|
for (int i = 0; i < mModel.rowCount(); i++) {
|
||||||
|
QStandardItem * const file = mModel.item(i, 0);
|
||||||
|
for (int j = 0; j < file->rowCount(); ) {
|
||||||
|
QStandardItem *errorItem = file->child(j, 0);
|
||||||
|
QVariantMap userdata = errorItem->data().toMap();
|
||||||
|
if (selectedIds.contains(userdata["id"].toString())) {
|
||||||
|
file->removeRow(j);
|
||||||
|
} else {
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
emit suppressIds(selectedIds.toList());
|
||||||
|
}
|
||||||
|
|
||||||
void ResultsTree::openContainingFolder()
|
void ResultsTree::openContainingFolder()
|
||||||
{
|
{
|
||||||
QString filePath = getFilePath(mContextItem, true);
|
QString filePath = getFilePath(mContextItem, true);
|
||||||
|
|
|
@ -210,6 +210,9 @@ signals:
|
||||||
*/
|
*/
|
||||||
void tagged();
|
void tagged();
|
||||||
|
|
||||||
|
/** Suppress Ids */
|
||||||
|
void suppressIds(QStringList ids);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
/**
|
/**
|
||||||
* @brief Slot to quickstart an error with default application
|
* @brief Slot to quickstart an error with default application
|
||||||
|
@ -267,6 +270,9 @@ protected slots:
|
||||||
*/
|
*/
|
||||||
void hideAllIdResult();
|
void hideAllIdResult();
|
||||||
|
|
||||||
|
/** Slot for context menu item to suppress all messages with the current message id */
|
||||||
|
void suppressSelectedIds();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Slot for context menu item to open the folder containing the current file.
|
* @brief Slot for context menu item to open the folder containing the current file.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -52,6 +52,7 @@ ResultsView::ResultsView(QWidget * parent) :
|
||||||
connect(mUI.mTree, &ResultsTree::checkSelected, this, &ResultsView::checkSelected);
|
connect(mUI.mTree, &ResultsTree::checkSelected, this, &ResultsView::checkSelected);
|
||||||
connect(mUI.mTree, &ResultsTree::selectionChanged, this, &ResultsView::updateDetails);
|
connect(mUI.mTree, &ResultsTree::selectionChanged, this, &ResultsView::updateDetails);
|
||||||
connect(mUI.mTree, &ResultsTree::tagged, this, &ResultsView::tagged);
|
connect(mUI.mTree, &ResultsTree::tagged, this, &ResultsView::tagged);
|
||||||
|
connect(mUI.mTree, &ResultsTree::suppressIds, this, &ResultsView::suppressIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResultsView::initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler)
|
void ResultsView::initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler)
|
||||||
|
|
|
@ -218,6 +218,9 @@ signals:
|
||||||
*/
|
*/
|
||||||
void tagged();
|
void tagged();
|
||||||
|
|
||||||
|
/** Suppress Ids */
|
||||||
|
void suppressIds(QStringList ids);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,6 +47,7 @@ void ThreadHandler::clearFiles()
|
||||||
mResults.clearFiles();
|
mResults.clearFiles();
|
||||||
mAnalyseWholeProgram = false;
|
mAnalyseWholeProgram = false;
|
||||||
mAddons.clear();
|
mAddons.clear();
|
||||||
|
mSuppressions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadHandler::setFiles(const QStringList &files)
|
void ThreadHandler::setFiles(const QStringList &files)
|
||||||
|
@ -93,6 +94,7 @@ void ThreadHandler::check(const Settings &settings)
|
||||||
|
|
||||||
for (int i = 0; i < mRunningThreadCount; i++) {
|
for (int i = 0; i < mRunningThreadCount; i++) {
|
||||||
mThreads[i]->setAddons(mAddons);
|
mThreads[i]->setAddons(mAddons);
|
||||||
|
mThreads[i]->setSuppressions(mSuppressions);
|
||||||
mThreads[i]->setVsIncludePaths(mVsIncludePaths);
|
mThreads[i]->setVsIncludePaths(mVsIncludePaths);
|
||||||
mThreads[i]->setClangPath(mClangPath);
|
mThreads[i]->setClangPath(mClangPath);
|
||||||
mThreads[i]->setDataDir(mDataDir);
|
mThreads[i]->setDataDir(mDataDir);
|
||||||
|
|
|
@ -75,6 +75,10 @@ public:
|
||||||
mAddons = addons;
|
mAddons = addons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSuppressions(const QStringList &s) {
|
||||||
|
mSuppressions = s;
|
||||||
|
}
|
||||||
|
|
||||||
void setVsIncludePaths(const QString &s) {
|
void setVsIncludePaths(const QString &s) {
|
||||||
mVsIncludePaths = s;
|
mVsIncludePaths = s;
|
||||||
}
|
}
|
||||||
|
@ -250,6 +254,7 @@ protected:
|
||||||
bool mAnalyseWholeProgram;
|
bool mAnalyseWholeProgram;
|
||||||
|
|
||||||
QStringList mAddons;
|
QStringList mAddons;
|
||||||
|
QStringList mSuppressions;
|
||||||
QString mVsIncludePaths;
|
QString mVsIncludePaths;
|
||||||
QString mClangPath;
|
QString mClangPath;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue