display all the available details of a finding
#include <string>
static char* f() {
return std::string().c_str();
}
Running Cppcheck on the command-line will show the following:
input.cpp:4:31: error: Returning object that will be invalid when returning. [returnDanglingLifetime]
return std::string().c_str();
^
input.cpp:4:31: note: Pointer to container is created here.
return std::string().c_str();
^
input.cpp:4:31: note: Returning object that will be invalid when returning.
return std::string().c_str();
^
input.cpp:4:5: error: Dangerous usage of c_str(). The value returned by c_str() is invalid after this call. [stlcstr]
return std::string().c_str();
^
input.cpp:3:0: style: The function 'f' is never used. [unusedFunction]
^
But CLion only shows the first message for returnDanglingLifetime:

For some findings this information is not sufficient to actually understand why it is being reported so we should provide these additional details in the IDE.
I have no suggestion on how to fix it since CLion has the same problem with clang-tidy (https://youtrack.jetbrains.com/issue/CPP-19518) and certain compiler warnings (no ticket yet / some of those are shown as separate entries which might not make sense on their own) so there's not something existing to leverage AFAIK.
I do wonder if it is possible to display additional information in the tooltip:

It seems that using #treeend in the description you can add additional information. Unfortunately they are not available straight-forward from the XML as they are given as additional location nodes.
Preview:

The ... indicates there's more information available via the tool-tip:
