@@ -632,7 +632,12 @@ std::string ErrorMessage::toString(bool verbose, const std::string &templateForm
632
632
// template is given. Reformat the output according to it
633
633
std::string result = templateFormat;
634
634
635
- findAndReplace (result, " {id}" , id);
635
+ // replace id with guideline if present
636
+ // replace severity with classification if present
637
+ const std::string idStr = guideline.empty () ? id : guideline;
638
+ const std::string severityStr = classification.empty () ? severityToString (severity) : classification;
639
+
640
+ findAndReplace (result, " {id}" , idStr);
636
641
637
642
std::string::size_type pos1 = result.find (" {inconclusive:" );
638
643
while (pos1 != std::string::npos) {
@@ -642,7 +647,7 @@ std::string ErrorMessage::toString(bool verbose, const std::string &templateForm
642
647
findAndReplace (result, replaceFrom, replaceWith);
643
648
pos1 = result.find (" {inconclusive:" , pos1);
644
649
}
645
- findAndReplace (result, " {severity}" , severityToString (severity) );
650
+ findAndReplace (result, " {severity}" , severityStr );
646
651
findAndReplace (result, " {cwe}" , std::to_string (cwe.id ));
647
652
findAndReplace (result, " {message}" , verbose ? mVerboseMessage : mShortMessage );
648
653
findAndReplace (result, " {remark}" , remark);
0 commit comments