Skip to content

Commit d0f565c

Browse files
committed
set message guideline/classification in StdLogger::reportErr
1 parent 90a3394 commit d0f565c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cli/cppcheckexecutor.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "cppcheckexecutor.h"
2020

2121
#include "analyzerinfo.h"
22+
#include "checkers.h"
2223
#include "checkersreport.h"
2324
#include "cmdlinelogger.h"
2425
#include "cmdlineparser.h"
@@ -621,12 +622,16 @@ void StdLogger::reportErr(const ErrorMessage &msg)
621622
if (!mShownErrors.insert(msg.toString(mSettings.verbose)).second)
622623
return;
623624

625+
ErrorMessage msgCopy = msg;
626+
msgCopy.guideline = checkers::getGuideline(msgCopy.id, mSettings.reportType);
627+
msgCopy.classification = checkers::getClassification(msgCopy.guideline, mSettings.reportType);
628+
624629
if (mSettings.outputFormat == Settings::OutputFormat::sarif)
625-
mSarifReport.addFinding(msg);
630+
mSarifReport.addFinding(msgCopy);
626631
else if (mSettings.xml)
627-
reportErr(msg.toXML());
632+
reportErr(msgCopy.toXML());
628633
else
629-
reportErr(msg.toString(mSettings.verbose, mSettings.templateFormat, mSettings.templateLocation));
634+
reportErr(msgCopy.toString(mSettings.verbose, mSettings.templateFormat, mSettings.templateLocation));
630635
}
631636

632637
/**

0 commit comments

Comments
 (0)