Cppcheck CLI; Better filtering of duplicate XML results when no -j is used

This commit is contained in:
Daniel Marjamäki 2021-04-05 20:09:45 +02:00
parent 93f46f6e7b
commit 93873be81a
1 changed files with 10 additions and 9 deletions

View File

@ -1035,11 +1035,6 @@ static inline std::string ansiToOEM(const std::string &msg, bool doConvert)
void CppCheckExecutor::reportErr(const std::string &errmsg) void CppCheckExecutor::reportErr(const std::string &errmsg)
{ {
// Alert only about unique errors
if (mShownErrors.find(errmsg) != mShownErrors.end())
return;
mShownErrors.insert(errmsg);
if (mErrorOutput) if (mErrorOutput)
*mErrorOutput << errmsg << std::endl; *mErrorOutput << errmsg << std::endl;
else { else {
@ -1096,11 +1091,17 @@ void CppCheckExecutor::reportErr(const ErrorMessage &msg)
{ {
if (mShowAllErrors) { if (mShowAllErrors) {
reportOut(msg.toXML()); reportOut(msg.toXML());
} else if (mSettings->xml) { return;
reportErr(msg.toXML());
} else {
reportErr(msg.toString(mSettings->verbose, mSettings->templateFormat, mSettings->templateLocation));
} }
// Alert only about unique errors
if (!mShownErrors.insert(msg.toString(mSettings->verbose)).second)
return;
if (mSettings->xml)
reportErr(msg.toXML());
else
reportErr(msg.toString(mSettings->verbose, mSettings->templateFormat, mSettings->templateLocation));
} }
void CppCheckExecutor::bughuntingReport(const std::string &str) void CppCheckExecutor::bughuntingReport(const std::string &str)