MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / createErrorMessage

Method createErrorMessage

test/testsarifreport.cpp:66–82  ·  view source on GitHub ↗

Helper to create an ErrorMessage

Source from the content-addressed store, hash-verified

64
65 // Helper to create an ErrorMessage
66 static ErrorMessage createErrorMessage(const std::string& id,
67 Severity severity,
68 const std::string& msg,
69 const std::string& file = "test.cpp",
70 int line = 10,
71 int column = 5,
72 int cweId = 0,
73 Certainty certainty = Certainty::normal)
74 {
75 ErrorMessage::FileLocation loc(file, line, column);
76 ErrorMessage errorMessage({loc}, file, severity, msg, id, certainty);
77 if (cweId > 0)
78 {
79 errorMessage.cwe = CWE(cweId);
80 }
81 return errorMessage;
82 }
83
84 // Helper to parse JSON and validate structure
85 static bool parseAndValidateJson(const std::string& json, picojson::value& root)

Callers

nothing calls this directly

Calls 1

CWEClass · 0.50

Tested by

no test coverage detected