Skip to content

Commit 93873be

Browse files
committed
Cppcheck CLI; Better filtering of duplicate XML results when no -j is used
1 parent 93f46f6 commit 93873be

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

cli/cppcheckexecutor.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,11 +1035,6 @@ static inline std::string ansiToOEM(const std::string &msg, bool doConvert)
10351035

10361036
void CppCheckExecutor::reportErr(const std::string &errmsg)
10371037
{
1038-
// Alert only about unique errors
1039-
if (mShownErrors.find(errmsg) != mShownErrors.end())
1040-
return;
1041-
1042-
mShownErrors.insert(errmsg);
10431038
if (mErrorOutput)
10441039
*mErrorOutput << errmsg << std::endl;
10451040
else {
@@ -1096,11 +1091,17 @@ void CppCheckExecutor::reportErr(const ErrorMessage &msg)
10961091
{
10971092
if (mShowAllErrors) {
10981093
reportOut(msg.toXML());
1099-
} else if (mSettings->xml) {
1094+
return;
1095+
}
1096+
1097+
// Alert only about unique errors
1098+
if (!mShownErrors.insert(msg.toString(mSettings->verbose)).second)
1099+
return;
1100+
1101+
if (mSettings->xml)
11001102
reportErr(msg.toXML());
1101-
} else {
1103+
else
11021104
reportErr(msg.toString(mSettings->verbose, mSettings->templateFormat, mSettings->templateLocation));
1103-
}
11041105
}
11051106

11061107
void CppCheckExecutor::bughuntingReport(const std::string &str)

0 commit comments

Comments
 (0)