ErrorLogger: add {cwe} (#1341)

This commit is contained in:
Kamil Dudka 2018-08-21 13:58:19 +02:00 committed by Daniel Marjamäki
parent f79849f6ba
commit 0ca6ab1a71
2 changed files with 2 additions and 0 deletions

View File

@ -1050,6 +1050,7 @@ void CmdLineParser::printHelp()
" {severity} severity\n" " {severity} severity\n"
" {message} warning message\n" " {message} warning message\n"
" {id} warning id\n" " {id} warning id\n"
" {cwe} CWE id (Common Weakness Enumeration)\n"
" {code} show the real code\n" " {code} show the real code\n"
" \\t insert tab\n" " \\t insert tab\n"
" \\n insert newline\n" " \\n insert newline\n"

View File

@ -487,6 +487,7 @@ std::string ErrorLogger::ErrorMessage::toString(bool verbose, const std::string
findAndReplace(result, replaceFrom, replaceWith); findAndReplace(result, replaceFrom, replaceWith);
} }
findAndReplace(result, "{severity}", Severity::toString(_severity)); findAndReplace(result, "{severity}", Severity::toString(_severity));
findAndReplace(result, "{cwe}", MathLib::toString(_cwe.id));
findAndReplace(result, "{message}", verbose ? mVerboseMessage : mShortMessage); findAndReplace(result, "{message}", verbose ? mVerboseMessage : mShortMessage);
findAndReplace(result, "{callstack}", _callStack.empty() ? emptyString : callStackToString(_callStack)); findAndReplace(result, "{callstack}", _callStack.empty() ? emptyString : callStackToString(_callStack));
if (!_callStack.empty()) { if (!_callStack.empty()) {