| 710 | } |
| 711 | |
| 712 | void 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 | |
| 750 | QStringList MainWindow::selectFilesToAnalyze(QFileDialog::FileMode mode) |
| 751 | { |
no test coverage detected