Cppcheck
|
Wrapper for error messages, provided by reportErr() More...
#include <errorlogger.h>
Classes | |
class | FileLocation |
File name and line number. More... | |
Public Member Functions | |
ErrorMessage (std::list< FileLocation > callStack, std::string file1, Severity severity, const std::string &msg, std::string id, Certainty certainty) | |
ErrorMessage (std::list< FileLocation > callStack, std::string file1, Severity severity, const std::string &msg, std::string id, const CWE &cwe, Certainty certainty) | |
ErrorMessage (const std::list< const Token * > &callstack, const TokenList *list, Severity severity, std::string id, const std::string &msg, Certainty certainty) | |
ErrorMessage (const std::list< const Token * > &callstack, const TokenList *list, Severity severity, std::string id, const std::string &msg, const CWE &cwe, Certainty certainty) | |
ErrorMessage (const ErrorPath &errorPath, const TokenList *tokenList, Severity severity, const char id[], const std::string &msg, const CWE &cwe, Certainty certainty) | |
ErrorMessage () | |
ErrorMessage (const tinyxml2::XMLElement *const errmsg) | |
std::string | toXML () const |
Format the error message in XML format. More... | |
std::string | toString (bool verbose, const std::string &templateFormat=emptyString, const std::string &templateLocation=emptyString) const |
Format the error message into a string. More... | |
std::string | serialize () const |
void | deserialize (const std::string &data) |
void | setmsg (const std::string &msg) |
set short and verbose messages More... | |
const std::string & | shortMessage () const |
Short message (single line short message) More... | |
const std::string & | verboseMessage () const |
Verbose message (may be the same as the short message) More... | |
const std::string & | symbolNames () const |
Symbol names. More... | |
Static Public Member Functions | |
static std::string | getXMLHeader (std::string productName) |
static std::string | getXMLFooter () |
static ErrorMessage | fromInternalError (const InternalError &internalError, const TokenList *tokenList, const std::string &filename, const std::string &msg=emptyString) |
Public Attributes | |
std::list< FileLocation > | callStack |
std::string | id |
std::string | file0 |
For GUI rechecking; source file (not header) More... | |
Severity | severity |
CWE | cwe |
Certainty | certainty |
std::size_t | hash |
Warning hash. More... | |
Static Private Member Functions | |
static std::string | fixInvalidChars (const std::string &raw) |
Private Attributes | |
std::string | mShortMessage |
Short message. More... | |
std::string | mVerboseMessage |
Verbose message. More... | |
std::string | mSymbolNames |
symbol names More... | |
Wrapper for error messages, provided by reportErr()
Definition at line 48 of file errorlogger.h.
ErrorMessage::ErrorMessage | ( | std::list< FileLocation > | callStack, |
std::string | file1, | ||
Severity | severity, | ||
const std::string & | msg, | ||
std::string | id, | ||
Certainty | certainty | ||
) |
Definition at line 63 of file errorlogger.cpp.
References setmsg().
ErrorMessage::ErrorMessage | ( | std::list< FileLocation > | callStack, |
std::string | file1, | ||
Severity | severity, | ||
const std::string & | msg, | ||
std::string | id, | ||
const CWE & | cwe, | ||
Certainty | certainty | ||
) |
Definition at line 78 of file errorlogger.cpp.
References setmsg().
ErrorMessage::ErrorMessage | ( | const std::list< const Token * > & | callstack, |
const TokenList * | list, | ||
Severity | severity, | ||
std::string | id, | ||
const std::string & | msg, | ||
Certainty | certainty | ||
) |
Definition at line 91 of file errorlogger.cpp.
References callStack, file0, TokenList::getFiles(), and setmsg().
ErrorMessage::ErrorMessage | ( | const std::list< const Token * > & | callstack, |
const TokenList * | list, | ||
Severity | severity, | ||
std::string | id, | ||
const std::string & | msg, | ||
const CWE & | cwe, | ||
Certainty | certainty | ||
) |
Definition at line 110 of file errorlogger.cpp.
References callStack, file0, TokenList::getFiles(), hash, and setmsg().
ErrorMessage::ErrorMessage | ( | const ErrorPath & | errorPath, |
const TokenList * | tokenList, | ||
Severity | severity, | ||
const char | id[], | ||
const std::string & | msg, | ||
const CWE & | cwe, | ||
Certainty | certainty | ||
) |
Definition at line 130 of file errorlogger.cpp.
References callStack, file0, TokenList::getFiles(), hash, replaceStr(), setmsg(), and startsWith().
ErrorMessage::ErrorMessage | ( | ) |
Definition at line 58 of file errorlogger.cpp.
|
explicit |
Definition at line 163 of file errorlogger.cpp.
References callStack, certainty, cwe, hash, CWE::id, inconclusive, mShortMessage, mSymbolNames, mVerboseMessage, none, normal, severity, and severityFromString().
void ErrorMessage::deserialize | ( | const std::string & | data | ) |
Definition at line 308 of file errorlogger.cpp.
References callStack, certainty, cwe, file0, hash, CWE::id, inconclusive, mShortMessage, mVerboseMessage, normal, ErrorMessage::FileLocation::setfile(), severity, severityFromString(), and strToInt().
Referenced by ProcessExecutor::handleRead().
|
staticprivate |
Definition at line 461 of file errorlogger.cpp.
Referenced by serialize(), and toXML().
|
static |
Definition at line 243 of file errorlogger.cpp.
References InternalError::details, error, InternalError::errorMessage, TokenList::getSourceFilePath(), InternalError::id, mVerboseMessage, normal, and InternalError::token.
Referenced by CppCheck::checkClang(), CppCheck::checkFile(), and CppCheck::executeAddonsWholeProgram().
|
static |
Definition at line 454 of file errorlogger.cpp.
Referenced by CppCheckExecutor::check_internal(), and CmdLineParser::parseFromArgs().
|
static |
Definition at line 429 of file errorlogger.cpp.
References Settings::getNameAndVersion(), and CppCheck::version().
Referenced by CppCheckExecutor::check_internal(), and CmdLineParser::parseFromArgs().
std::string ErrorMessage::serialize | ( | ) | const |
Definition at line 269 of file errorlogger.cpp.
References callStack, certainty, cwe, file0, fixInvalidChars(), hash, CWE::id, inconclusive, mShortMessage, mVerboseMessage, serializeString(), severity, and severityToString().
void ErrorMessage::setmsg | ( | const std::string & | msg | ) |
set short and verbose messages
Definition at line 210 of file errorlogger.cpp.
References endsWith(), mShortMessage, mSymbolNames, mVerboseMessage, replaceStr(), and startsWith().
Referenced by CppCheck::analyseClangTidy(), and ErrorMessage().
|
inline |
Short message (single line short message)
Definition at line 181 of file errorlogger.h.
Referenced by ErrorLogger::plistData().
|
inline |
Symbol names.
Definition at line 191 of file errorlogger.h.
std::string ErrorMessage::toString | ( | bool | verbose, |
const std::string & | templateFormat = emptyString , |
||
const std::string & | templateLocation = emptyString |
||
) | const |
Format the error message into a string.
verbose | use verbose message |
templateFormat | Empty string to use default output format or template to be used. E.g. "{file}:{line},{severity},{id},{message}" |
templateLocation | Format Empty string to use default output format or template to be used. E.g. "{file}:{line},{info}" |
Definition at line 604 of file errorlogger.cpp.
References callStack, ErrorLogger::callStackToString(), certainty, cwe, findAndReplace(), CWE::id, inconclusive, mShortMessage, mVerboseMessage, none, readCode(), replace(), severity, and severityToString().
Referenced by Executor::hasToLog(), and CppCheck::reportErr().
std::string ErrorMessage::toXML | ( | ) | const |
Format the error message in XML format.
Definition at line 481 of file errorlogger.cpp.
References callStack, certainty, cwe, file0, fixInvalidChars(), hash, CWE::id, inconclusive, mShortMessage, mSymbolNames, mVerboseMessage, severity, and severityToString().
Referenced by AnalyzerInformation::reportErr(), and Check::writeToErrorList().
|
inline |
Verbose message (may be the same as the short message)
Definition at line 186 of file errorlogger.h.
std::list<FileLocation> ErrorMessage::callStack |
Definition at line 164 of file errorlogger.h.
Referenced by CppCheck::analyseClangTidy(), deserialize(), ErrorItem::ErrorItem(), ErrorMessage(), CppCheck::executeAddons(), ErrorLogger::plistData(), CppCheck::reportErr(), serialize(), toString(), and toXML().
Certainty ErrorMessage::certainty |
Definition at line 172 of file errorlogger.h.
Referenced by deserialize(), ErrorMessage(), serialize(), toString(), and toXML().
CWE ErrorMessage::cwe |
Definition at line 171 of file errorlogger.h.
Referenced by deserialize(), ErrorMessage(), serialize(), toString(), and toXML().
std::string ErrorMessage::file0 |
For GUI rechecking; source file (not header)
Definition at line 168 of file errorlogger.h.
Referenced by CppCheck::analyseClangTidy(), deserialize(), ErrorMessage(), Executor::hasToLog(), CppCheck::reportErr(), serialize(), and toXML().
std::size_t ErrorMessage::hash |
Warning hash.
Definition at line 175 of file errorlogger.h.
Referenced by deserialize(), ErrorMessage(), serialize(), and toXML().
std::string ErrorMessage::id |
Definition at line 165 of file errorlogger.h.
Referenced by CppCheck::analyseClangTidy(), NewSuppressionDialog::NewSuppressionDialog(), ErrorLogger::plistData(), and CppCheck::reportErr().
|
private |
Short message.
Definition at line 201 of file errorlogger.h.
Referenced by deserialize(), ErrorMessage(), serialize(), setmsg(), toString(), and toXML().
|
private |
symbol names
Definition at line 207 of file errorlogger.h.
Referenced by ErrorMessage(), setmsg(), and toXML().
|
private |
Verbose message.
Definition at line 204 of file errorlogger.h.
Referenced by deserialize(), ErrorMessage(), fromInternalError(), serialize(), setmsg(), toString(), and toXML().
Severity ErrorMessage::severity |
Definition at line 170 of file errorlogger.h.
Referenced by CppCheck::analyseClangTidy(), deserialize(), ErrorMessage(), ErrorLogger::plistData(), ThreadResult::reportErr(), CppCheck::reportErr(), serialize(), toString(), and toXML().