Skip to content

Commit caa0cd8

Browse files
committed
add "Dir " prefix to directives for all report types
1 parent 1eedefb commit caa0cd8

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/errorlogger.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,8 +1043,6 @@ std::string getGuideline(const std::string &errId, ReportType reportType,
10431043
case ReportType::misraC2025:
10441044
if (errId.rfind("misra-c20", 0) == 0 || errId.rfind("premium-misra-c-20", 0) == 0)
10451045
guideline = errId.substr(errId.rfind('-') + 1);
1046-
if (errId.find("-dir-") != std::string::npos)
1047-
guideline = "Dir " + guideline;
10481046
break;
10491047
case ReportType::misraCpp2008:
10501048
if (errId.rfind("misra-cpp-2008-", 0) == 0)
@@ -1058,19 +1056,21 @@ std::string getGuideline(const std::string &errId, ReportType reportType,
10581056
break;
10591057
}
10601058

1059+
const std::string prefix = errId.find("-dir-") != std::string::npos ? "Dir " : "";
1060+
10611061
if (!guideline.empty())
1062-
return guideline;
1062+
return prefix + guideline;
10631063

10641064
auto it = guidelineMapping.find(errId);
10651065

10661066
if (it != guidelineMapping.cend())
1067-
return it->second;
1067+
return prefix + it->second;
10681068

10691069
if (severity == Severity::error || severity == Severity::warning) {
10701070
it = guidelineMapping.find("error");
10711071

10721072
if (it != guidelineMapping.cend())
1073-
return it->second;
1073+
return prefix + it->second;
10741074
}
10751075

10761076
return "";

0 commit comments

Comments
 (0)