diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 15f3e8e0665..3fd4d702a76 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -559,13 +559,24 @@ void MainWindow::saveSettings() const mUI->mResults->saveSettings(mSettings); } -void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLib, const bool checkConfig) +void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLib, const bool checkConfig, const QStringList& recheckFiles) { Settings checkSettings; auto supprs = std::make_shared(); if (!getCppcheckSettings(checkSettings, *supprs)) return; + // filter requested files + if (!recheckFiles.isEmpty()) { + QSet filesToCheck; + for (const QString& file : recheckFiles) { + filesToCheck.insert(file); + } + p.fileSettings.remove_if([&](const FileSettings& fs) { + return !filesToCheck.contains(QString::fromStdString(fs.filename())); + }); + } + clearResults(); mIsLogfileLoaded = false; @@ -1958,7 +1969,7 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const QStringLis msg.exec(); return; } - doAnalyzeProject(p, checkLib, checkConfig); // TODO: avoid copy + doAnalyzeProject(p, checkLib, checkConfig, recheckFiles); // TODO: avoid copy return; } diff --git a/gui/mainwindow.h b/gui/mainwindow.h index febd3a41d4c..c654a2c94f0 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -309,7 +309,7 @@ private slots: * @param checkLib Flag to indicate if library should be checked * @param checkConfig Flag to indicate if the configuration should be checked. */ - void doAnalyzeProject(ImportProject p, bool checkLib = false, bool checkConfig = false); + void doAnalyzeProject(ImportProject p, bool checkLib = false, bool checkConfig = false, const QStringList& recheckFiles = QStringList()); /** * @brief Analyze all files specified in parameter files