| 43 | Analyzer::~Analyzer() = default; |
| 44 | |
| 45 | KDevelop::CompileAnalyzeJob * Analyzer::createJob(KDevelop::IProject* project, |
| 46 | const KDevelop::Path& buildDirectory, |
| 47 | const QUrl& url, const QStringList& filePaths) |
| 48 | { |
| 49 | Q_UNUSED(url); |
| 50 | |
| 51 | ClangTidyProjectSettings projectSettings; |
| 52 | projectSettings.setSharedConfig(project->projectConfiguration()); |
| 53 | projectSettings.load(); |
| 54 | |
| 55 | Job::Parameters params; |
| 56 | |
| 57 | params.projectRootDir = project->path().toLocalFile(); |
| 58 | |
| 59 | auto clangTidyPath = KDevelop::Path(ClangTidySettings::clangtidyPath()).toLocalFile(); |
| 60 | params.executablePath = clangTidyPath; |
| 61 | |
| 62 | params.filePaths = filePaths; |
| 63 | params.buildDir = buildDirectory.toLocalFile(); |
| 64 | |
| 65 | params.additionalParameters = projectSettings.additionalParameters(); |
| 66 | |
| 67 | QString checkSetSelectionId = projectSettings.checkSetSelection(); |
| 68 | if (checkSetSelectionId == QLatin1String("Default")) { |
| 69 | checkSetSelectionId = m_checkSetSelectionManager->defaultCheckSetSelectionId(); |
| 70 | } |
| 71 | const auto enabledChecks = checkSetSelectionId.isEmpty() ? projectSettings.enabledChecks() : m_checkSetSelectionManager->checkSetSelection(checkSetSelectionId).selectionAsString(); |
| 72 | if (!enabledChecks.isEmpty()) { |
| 73 | params.enabledChecks = enabledChecks; |
| 74 | } else { |
| 75 | auto& checkSet = m_plugin->checkSet(); |
| 76 | // make sure the defaults are up-to-date TODO: make async |
| 77 | checkSet.setClangTidyPath(clangTidyPath); |
| 78 | params.enabledChecks = checkSet.defaults().join(QLatin1Char(',')); |
| 79 | } |
| 80 | params.useConfigFile = projectSettings.useConfigFile(); |
| 81 | params.headerFilter = projectSettings.headerFilter(); |
| 82 | params.checkSystemHeaders = projectSettings.checkSystemHeaders(); |
| 83 | |
| 84 | params.parallelJobCount = |
| 85 | ClangTidySettings::parallelJobsEnabled() ? |
| 86 | (ClangTidySettings::parallelJobsAutoCount() ? |
| 87 | QThread::idealThreadCount() : |
| 88 | ClangTidySettings::parallelJobsFixedCount()) : |
| 89 | 1; |
| 90 | |
| 91 | return new Job(params, this); |
| 92 | } |
| 93 | |
| 94 | } |
| 95 |
nothing calls this directly
no test coverage detected