Skip to content

Commit e87628b

Browse files
committed
Filter out duplicate error messages in cli.
1 parent 96beb94 commit e87628b

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

cli/cppcheckexecutor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
255255

256256
void CppCheckExecutor::reportErr(const std::string &errmsg)
257257
{
258+
// Alert only about unique errors
259+
if (std::find(_errorList.begin(), _errorList.end(), errmsg) != _errorList.end())
260+
return;
261+
262+
_errorList.push_back(errmsg);
258263
std::cerr << errmsg << std::endl;
259264
}
260265

cli/cppcheckexecutor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ class CppCheckExecutor : public ErrorLogger
107107

108108
private:
109109

110+
/**
111+
* Used to filter out duplicate error messages.
112+
*/
113+
std::list<std::string> _errorList;
114+
110115
/**
111116
* Report progress time
112117
*/

0 commit comments

Comments
 (0)