void TestFileList::filterFiles4() { FileList list; QStringList filters; filters << "dir1/"; list.AddExcludeList(filters); list.AddDirectory(QString(SRCDIR) + "/../data/files", true); QStringList files = list.GetFileList(); QCOMPARE(files.size(), 8); QDir dir(QString(SRCDIR) + "/../data/files"); QString base = dir.canonicalPath(); QVERIFY(! files.contains(base + "/dir1/foo1.cpp")); QVERIFY(! files.contains(base + "/dir1/dir11/foo11.cpp")); }
void MainWindow::DoCheckFiles(const QStringList &files) { if (files.isEmpty()) { return; } ClearResults(); FileList pathList; pathList.AddPathList(files); if (mProject) pathList.AddExcludeList(mProject->GetProjectFile()->GetExcludedPaths()); QStringList fileNames = pathList.GetFileList(); mUI.mResults->Clear(); mThread->ClearFiles(); if (fileNames.isEmpty()) { QMessageBox msg(QMessageBox::Warning, tr("Cppcheck"), tr("No suitable files found to check!"), QMessageBox::Ok, this); msg.exec(); return; } mUI.mResults->CheckingStarted(fileNames.count()); mThread->SetFiles(fileNames); QDir inf(mCurrentDirectory); const QString checkPath = inf.canonicalPath(); mSettings->setValue(SETTINGS_CHECK_PATH, checkPath); CheckLockDownUI(); // lock UI while checking mUI.mResults->SetCheckDirectory(checkPath); Settings checkSettings = GetCppcheckSettings(); if (mProject) qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename(); mThread->Check(checkSettings, false); }
void TestFileList::filterFiles() { FileList list; QStringList filters; filters << "foo1.cpp" << "foo3.cc"; list.AddExcludeList(filters); list.AddFile(QString(SRCDIR) + "/../data/files/foo1.cpp"); list.AddFile(QString(SRCDIR) + "/../data/files/foo2.cxx"); list.AddFile(QString(SRCDIR) + "/../data/files/foo3.cc"); list.AddFile(QString(SRCDIR) + "/../data/files/foo4.c"); list.AddFile(QString(SRCDIR) + "/../data/files/foo5.c++"); list.AddFile(QString(SRCDIR) + "/../data/files/foo6.txx"); list.AddFile(QString(SRCDIR) + "/../data/files/foo7.tpp"); QStringList files = list.GetFileList(); QCOMPARE(files.size(), 5); QDir dir(QString(SRCDIR) + "/../data/files"); QString base = dir.canonicalPath(); QVERIFY(! files.contains(base + "/foo1.cpp")); QVERIFY(! files.contains(base + "/foo3.cpp")); }