Skip to content

Commit

Permalink
set guidline/classification for cert c/c++
Browse files Browse the repository at this point in the history
  • Loading branch information
ludviggunne committed Dec 11, 2024
1 parent c5e4c41 commit a74bf8e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,12 @@ void CppCheck::setClassification(ErrorMessage &errMsg) const {
case Settings::ReportType::Autosar:
errMsg.classification = getClassification(checkers::autosarInfo, guideline);
return;
case Settings::ReportType::CertC:
errMsg.classification = getClassification(checkers::certCInfo, guideline);
return;
case Settings::ReportType::CertCpp:
errMsg.classification = getClassification(checkers::certCppInfo, guideline);
return;
case Settings::ReportType::MisraC:
{
std::array<std::string, 2> split;
Expand Down Expand Up @@ -1520,6 +1526,14 @@ void CppCheck::setGuideline(ErrorMessage &errMsg) const {
errMsg.guideline = errId.substr(23);
}
return;
case Settings::ReportType::CertC:
case Settings::ReportType::CertCpp:
if (errId.rfind("premium-cert-", 0) == 0) {
errMsg.guideline = errId.substr(13);
std::transform(errMsg.guideline.begin(), errMsg.guideline.end(),
errMsg.guideline.begin(), static_cast<int (*)(int)>(std::toupper));
}
return;
case Settings::ReportType::MisraC:
if (errId.rfind("misra-c20", 0) == 0) {
errMsg.guideline = errId.substr(errId.rfind("-") + 1);
Expand Down

0 comments on commit a74bf8e

Please sign in to comment.