@@ -84,12 +84,12 @@ namespace {
8484 mFindings .push_back (std::move (msg));
8585 }
8686
87- std::string getRuleShortDescription (const std::string& ruleId ) const {
88- return getRuleDescription (ruleId , false );
87+ std::string getRuleShortDescription (const ErrorMessage& finding ) const {
88+ return getRuleDescription (finding. id , false , finding );
8989 }
9090
91- std::string getRuleFullDescription (const std::string& ruleId ) const {
92- return getRuleDescription (ruleId , true );
91+ std::string getRuleFullDescription (const ErrorMessage& finding ) const {
92+ return getRuleDescription (finding. id , true , finding );
9393 }
9494
9595 picojson::array serializeRules () const {
@@ -106,15 +106,15 @@ namespace {
106106 rule[" name" ] = picojson::value (finding.shortMessage ());
107107 // rule.shortDescription.text
108108 picojson::object shortDescription;
109- shortDescription[" text" ] = picojson::value (getRuleShortDescription (finding. id ));
109+ shortDescription[" text" ] = picojson::value (getRuleShortDescription (finding));
110110 rule[" shortDescription" ] = picojson::value (shortDescription);
111111 // rule.fullDescription.text
112112 picojson::object fullDescription;
113- fullDescription[" text" ] = picojson::value (getRuleFullDescription (finding. id ));
113+ fullDescription[" text" ] = picojson::value (getRuleFullDescription (finding));
114114 rule[" fullDescription" ] = picojson::value (fullDescription);
115115 // rule.help.text
116116 picojson::object help;
117- help[" text" ] = picojson::value (getRuleFullDescription (finding. id ));
117+ help[" text" ] = picojson::value (getRuleFullDescription (finding));
118118 rule[" help" ] = picojson::value (help);
119119 // rule.properties.precision, rule.properties.problem.severity
120120 picojson::object properties;
@@ -226,7 +226,7 @@ namespace {
226226 }
227227 private:
228228 // Following the pattern of existing mapping functions in errorlogger.cpp
229- std::string getRuleDescription (const std::string& ruleId, bool fullDescription) const {
229+ std::string getRuleDescription (const std::string& ruleId, bool fullDescription, const ErrorMessage& finding ) const {
230230 // Structure similar to IdMapping in checkers.h but for descriptions
231231 struct RuleDescription {
232232 const char * ruleId;
@@ -272,6 +272,14 @@ namespace {
272272 " Detects syntax errors in the source code." },
273273 {" cppcheckError" , " Cppcheck internal error" ,
274274 " Internal error occurred during analysis." },
275+ {" unusedFunction" , " Unused function" ,
276+ " Detects functions that are declared but never called in the code." },
277+ {" ignoredReturnValue" , " Ignored return value" ,
278+ " Detects when the return value of a function is ignored when it should be checked." },
279+ {" passedByValue" , " Parameter passed by value" ,
280+ " Detects when function parameters should be passed by const reference instead of by value for better performance." },
281+ {" derefInvalidIteratorRedundantCheck" , " Redundant iterator check" ,
282+ " Detects redundant checks for invalid iterator dereferencing." },
275283 // Add more mappings as needed
276284 };
277285
@@ -282,8 +290,8 @@ namespace {
282290 }
283291 }
284292
285- // Fallback for unknown rules
286- return fullDescription ? ruleId : ruleId ;
293+ // Fallback for unknown rules - use the actual error message content
294+ return fullDescription ? finding. verboseMessage () : finding. shortMessage () ;
287295 }
288296
289297 static bool isSecurityRelatedFinding (const std::string& ruleId) {
0 commit comments