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

Method analyzeCode

gui/mainwindow.cpp:712–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

710}
711
712void MainWindow::analyzeCode(const QString& code, const QString& filename)
713{
714 Settings checkSettings;
715 Suppressions supprs;
716 if (!getCppcheckSettings(checkSettings, supprs))
717 return;
718
719 // TODO: split ErrorLogger from ThreadResult
720 // Initialize dummy ThreadResult as ErrorLogger
721 ThreadResult result;
722 connect(&result, SIGNAL(progress(int,QString)),
723 mUI->mResults, SLOT(progress(int,QString)));
724 connect(&result, SIGNAL(error(ErrorItem)),
725 mUI->mResults, SLOT(error(ErrorItem)));
726 connect(&result, SIGNAL(log(QString)),
727 mUI->mResults, SLOT(log(QString)));
728 connect(&result, SIGNAL(debugError(ErrorItem)),
729 mUI->mResults, SLOT(debugError(ErrorItem)));
730
731 // Create CppCheck instance
732 CppCheck cppcheck(checkSettings, supprs, result, nullptr, true, nullptr);
733
734 // Check
735 checkLockDownUI();
736 clearResults();
737 mUI->mResults->checkingStarted(1);
738 {
739 const std::string code_s = code.toStdString();
740 // TODO: apply enforcedLanguage?
741 cppcheck.checkBuffer(FileWithDetails(filename.toStdString(), Path::identify(filename.toStdString(), false), 0), code_s.data(), code_s.size());
742 }
743 analysisDone();
744
745 // Expand results
746 if (mUI->mResults->hasVisibleResults())
747 mUI->mResults->expandAllResults();
748}
749
750QStringList MainWindow::selectFilesToAnalyze(QFileDialog::FileMode mode)
751{

Callers 1

checkButtonClickedMethod · 0.80

Calls 6

checkingStartedMethod · 0.80
checkBufferMethod · 0.80
FileWithDetailsClass · 0.70
dataMethod · 0.45
sizeMethod · 0.45
hasVisibleResultsMethod · 0.45

Tested by

no test coverage detected