MCPcopy Create free account
hub / github.com/KDE/kdevelop / createJob

Method createJob

plugins/clangtidy/analyzer.cpp:45–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43Analyzer::~Analyzer() = default;
44
45KDevelop::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

Callers

nothing calls this directly

Calls 13

toLocalFileMethod · 0.80
enabledChecksMethod · 0.80
setClangTidyPathMethod · 0.80
joinMethod · 0.80
PathClass · 0.50
projectConfigurationMethod · 0.45
loadMethod · 0.45
pathMethod · 0.45
checkSetSelectionMethod · 0.45
isEmptyMethod · 0.45
selectionAsStringMethod · 0.45

Tested by

no test coverage detected