Added --template=cppcheck2 output format
This commit is contained in:
parent
6cb563b3fe
commit
a3c0eecccf
|
@ -996,7 +996,7 @@ void CmdLineParser::PrintHelp()
|
||||||
" '{file}:{line},{severity},{id},{message}' or\n"
|
" '{file}:{line},{severity},{id},{message}' or\n"
|
||||||
" '{file}({line}):({severity}) {message}' or\n"
|
" '{file}({line}):({severity}) {message}' or\n"
|
||||||
" '{callstack} {message}'\n"
|
" '{callstack} {message}'\n"
|
||||||
" Pre-defined templates: clang, gcc, vs, edit.\n"
|
" Pre-defined templates: clang, cppcheck2, gcc, vs, edit.\n"
|
||||||
" -v, --verbose Output more detailed error information.\n"
|
" -v, --verbose Output more detailed error information.\n"
|
||||||
" --version Print out version number.\n"
|
" --version Print out version number.\n"
|
||||||
" --xml Write results in xml format to error stream (stderr).\n"
|
" --xml Write results in xml format to error stream (stderr).\n"
|
||||||
|
|
|
@ -169,7 +169,7 @@ protected:
|
||||||
ErrorPath errorPath;
|
ErrorPath errorPath;
|
||||||
if (!value) {
|
if (!value) {
|
||||||
errorPath.push_back(ErrorPathItem(errtok,bug));
|
errorPath.push_back(ErrorPathItem(errtok,bug));
|
||||||
} else if (_settings->verbose || _settings->xml || _settings->outputFormat == "clang") {
|
} else if (_settings->verbose || _settings->xml || _settings->outputFormat == "clang" || _settings->outputFormat == "cppcheck2") {
|
||||||
errorPath = value->errorPath;
|
errorPath = value->errorPath;
|
||||||
errorPath.push_back(ErrorPathItem(errtok,bug));
|
errorPath.push_back(ErrorPathItem(errtok,bug));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -413,7 +413,7 @@ std::string ErrorLogger::ErrorMessage::toString(bool verbose, const std::string
|
||||||
return text.str();
|
return text.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (outputFormat == "clang") {
|
else if (outputFormat == "clang" || outputFormat == "cppcheck2") {
|
||||||
std::ostringstream text;
|
std::ostringstream text;
|
||||||
if (_callStack.empty()) {
|
if (_callStack.empty()) {
|
||||||
text << "nofile:0:0: ";
|
text << "nofile:0:0: ";
|
||||||
|
@ -421,8 +421,16 @@ std::string ErrorLogger::ErrorMessage::toString(bool verbose, const std::string
|
||||||
const ErrorLogger::ErrorMessage::FileLocation &loc = _callStack.back();
|
const ErrorLogger::ErrorMessage::FileLocation &loc = _callStack.back();
|
||||||
text << loc.getfile() << ':' << loc.line << ':' << loc.col << ": ";
|
text << loc.getfile() << ':' << loc.line << ':' << loc.col << ": ";
|
||||||
}
|
}
|
||||||
text << ((_id == "syntaxError" || _id=="internalError") ? "error: " : "warning: ")
|
|
||||||
<< (verbose ? _verboseMessage : _shortMessage)
|
if (outputFormat == "clang")
|
||||||
|
text << ((_id == "syntaxError" || _id=="internalError") ? "error: " : "warning: ");
|
||||||
|
else {
|
||||||
|
if (_inconclusive)
|
||||||
|
text << "inconclusive ";
|
||||||
|
text << Severity::toString(_severity) << ": ";
|
||||||
|
}
|
||||||
|
|
||||||
|
text << (verbose ? _verboseMessage : _shortMessage)
|
||||||
<< " [" << _id << ']';
|
<< " [" << _id << ']';
|
||||||
|
|
||||||
if (_callStack.size() <= 1U)
|
if (_callStack.size() <= 1U)
|
||||||
|
|
|
@ -152,7 +152,7 @@ def scanarchive(filepath, jobs, cpulimit):
|
||||||
cmd = 'cpulimit --limit=' + cpulimit
|
cmd = 'cpulimit --limit=' + cpulimit
|
||||||
else:
|
else:
|
||||||
cmd = 'nice --adjustment=1000'
|
cmd = 'nice --adjustment=1000'
|
||||||
cmd = cmd + ' ../cppcheck-O2 -D__GCC__ --enable=style --inconclusive --error-exitcode=0 --exception-handling=stderr ' + jobs + ' --template=clang .'
|
cmd = cmd + ' ../cppcheck-O2 -D__GCC__ --enable=style --inconclusive --error-exitcode=0 --exception-handling=stderr ' + jobs + ' --template=cppcheck2 .'
|
||||||
cmds = cmd.split()
|
cmds = cmd.split()
|
||||||
|
|
||||||
p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
|
Loading…
Reference in New Issue