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

Method postProcessStderr

plugins/cppcheck/job.cpp:89–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void Job::postProcessStderr(const QStringList& lines)
90{
91 static const auto xmlStartRegex = QRegularExpression(QStringLiteral("\\s*<"));
92
93 for (const QString & line : lines) {
94 // unfortunately sometime cppcheck send non-XML messages to stderr.
95 // For example, if we pass '-I /missing_include_dir' to the argument list,
96 // then stderr output will contains such line (tested on cppcheck 1.72):
97 //
98 // (information) Couldn't find path given by -I '/missing_include_dir'
99 //
100 // Therefore we must 'move' such messages to m_standardOutput.
101
102 if (line.indexOf(xmlStartRegex) != -1) { // the line contains XML
103 m_xmlOutput << line;
104
105 m_parser->addData(line);
106
107 m_problems = m_parser->parse();
108 emitProblems();
109 }
110 else {
111 KDevelop::IProblem::Ptr problem(new KDevelop::DetectedProblem(i18n("Cppcheck")));
112
113 problem->setSeverity(KDevelop::IProblem::Error);
114 problem->setDescription(line);
115 problem->setExplanation(QStringLiteral("Check your cppcheck settings"));
116
117 m_problems = {problem};
118 emitProblems();
119
120 if (m_showXmlOutput) {
121 m_standardOutput << line;
122 } else {
123 postProcessStdout({line});
124 }
125 }
126 }
127
128 if (status() == KDevelop::OutputExecuteJob::JobStatus::JobRunning && m_showXmlOutput) {
129 KDevelop::OutputExecuteJob::postProcessStderr(lines);
130 }
131}
132
133void Job::start()
134{

Callers 1

testJobMethod · 0.45

Calls 6

addDataMethod · 0.80
indexOfMethod · 0.45
parseMethod · 0.45
setSeverityMethod · 0.45
setDescriptionMethod · 0.45
setExplanationMethod · 0.45

Tested by 1

testJobMethod · 0.36