MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / doAnalyzeFiles

Method doAnalyzeFiles

gui/mainwindow.cpp:641–710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

639}
640
641void MainWindow::doAnalyzeFiles(const QStringList &files, const bool checkLib, const bool checkConfig)
642{
643 if (files.isEmpty())
644 return;
645
646 Settings checkSettings;
647 auto supprs = std::make_shared<Suppressions>();
648 if (!getCppcheckSettings(checkSettings, *supprs))
649 return;
650
651 clearResults();
652
653 mIsLogfileLoaded = false;
654 FileList pathList;
655 pathList.addPathList(files);
656 if (mProjectFile) {
657 pathList.addExcludeList(mProjectFile->getExcludedPaths());
658 } else {
659 enableProjectActions(false);
660 }
661 QStringList fileNames = pathList.getFileList();
662
663 mUI->mResults->clear(true);
664 mUI->mResults->setResultsSource(ResultsTree::ResultsSource::Analysis);
665 mThread->clearFiles();
666
667 if (fileNames.isEmpty()) {
668 QMessageBox msg(QMessageBox::Warning,
669 tr("Cppcheck"),
670 tr("No suitable files found to analyze!"),
671 QMessageBox::Ok,
672 this);
673 msg.exec();
674 return;
675 }
676
677 std::list<FileWithDetails> fdetails = enrichFilesForAnalysis(fileNames, checkSettings);
678
679 // TODO: lock UI here?
680 mUI->mResults->checkingStarted(fdetails.size());
681 mThread->setFiles(std::move(fdetails));
682 if (mProjectFile && !checkConfig)
683 mThread->setAddonsAndTools(mProjectFile->getAddonsAndTools());
684 mThread->setSuppressions(mProjectFile ? mProjectFile->getCheckingSuppressions() : QList<SuppressionList::Suppression>());
685 QDir inf(mCurrentDirectory);
686 const QString checkPath = inf.canonicalPath();
687 setPath(SETTINGS_LAST_CHECK_PATH, checkPath);
688
689 checkLockDownUI(); // lock UI while checking
690
691 mUI->mResults->setCheckDirectory(checkPath);
692 checkSettings.checkLibrary = checkLib;
693 checkSettings.checkConfiguration = checkConfig;
694
695 if (mProjectFile)
696 qDebug() << "Checking project file" << mProjectFile->getFilename();
697
698 if (!checkSettings.buildDir.empty()) {

Callers

nothing calls this directly

Calls 15

setPathFunction · 0.85
isEmptyMethod · 0.80
addExcludeListMethod · 0.80
getFileListMethod · 0.80
checkingStartedMethod · 0.80
setAddonsAndToolsMethod · 0.80
getAddonsAndToolsMethod · 0.80
loadSummariesMethod · 0.80
setCheckFilesMethod · 0.80
setCheckSettingsMethod · 0.80
addPathListMethod · 0.45

Tested by

no test coverage detected