From 0ca6ab1a713d9a381c4b84d24800fb6200e5e7a5 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 21 Aug 2018 13:58:19 +0200 Subject: [PATCH] ErrorLogger: add {cwe} (#1341) --- cli/cmdlineparser.cpp | 1 + lib/errorlogger.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index d96dd159e..c0150216e 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -1050,6 +1050,7 @@ void CmdLineParser::printHelp() " {severity} severity\n" " {message} warning message\n" " {id} warning id\n" + " {cwe} CWE id (Common Weakness Enumeration)\n" " {code} show the real code\n" " \\t insert tab\n" " \\n insert newline\n" diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index f21641e42..f9ff4f4a2 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -487,6 +487,7 @@ std::string ErrorLogger::ErrorMessage::toString(bool verbose, const std::string findAndReplace(result, replaceFrom, replaceWith); } findAndReplace(result, "{severity}", Severity::toString(_severity)); + findAndReplace(result, "{cwe}", MathLib::toString(_cwe.id)); findAndReplace(result, "{message}", verbose ? mVerboseMessage : mShortMessage); findAndReplace(result, "{callstack}", _callStack.empty() ? emptyString : callStackToString(_callStack)); if (!_callStack.empty()) {