Skip to content

Commit daf0148

Browse files
committed
gui recheck
1 parent 26acdb1 commit daf0148

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎gui/mainwindow.cpp‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLib, const bo
647647
mUI->mResults->setCheckSettings(checkSettings);
648648
}
649649

650-
void MainWindow::doAnalyzeFiles(const QStringList &files, const bool checkLib, const bool checkConfig)
650+
void MainWindow::doAnalyzeFiles(const QStringList &files, const bool checkLib, const bool checkConfig, const bool checkUnusedExcludes)
651651
{
652652
if (files.isEmpty())
653653
return;
@@ -683,7 +683,7 @@ void MainWindow::doAnalyzeFiles(const QStringList &files, const bool checkLib, c
683683
return;
684684
}
685685

686-
const QStringList& unmatchedExcludePaths = pathList.getUnmatchedExcludes();
686+
const QStringList& unmatchedExcludePaths = checkUnusedExcludes ? pathList.getUnmatchedExcludes() : QStringList();
687687
if (!unmatchedExcludePaths.isEmpty()) {
688688
QMessageBox msg(QMessageBox::Warning,
689689
"Cppcheck",
@@ -1992,7 +1992,9 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const QStringLis
19921992
if (paths.isEmpty()) {
19931993
paths << mCurrentDirectory;
19941994
}
1995-
doAnalyzeFiles(paths, checkLib, checkConfig);
1995+
// the exclude paths can only be validated when the whole project is analyzed
1996+
const bool checkUnusedExcludes = recheckFiles.isEmpty();
1997+
doAnalyzeFiles(paths, checkLib, checkConfig, checkUnusedExcludes);
19961998
}
19971999

19982000
void MainWindow::newProjectFile()

‎gui/mainwindow.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,9 @@ private slots:
317317
* @param files List of files and/or directories to analyze
318318
* @param checkLib Flag to indicate if library should be checked
319319
* @param checkConfig Flag to indicate if the configuration should be checked.
320+
* @param checkUnusedExcludes Flag to indicate if unused exclude paths should be reported.
320321
*/
321-
void doAnalyzeFiles(const QStringList &files, bool checkLib = false, bool checkConfig = false);
322+
void doAnalyzeFiles(const QStringList &files, bool checkLib = false, bool checkConfig = false, bool checkUnusedExcludes = false);
322323

323324
/**
324325
* @brief Get our default cppcheck settings and read project file.

0 commit comments

Comments
 (0)