Helper to create an ErrorMessage
| 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) |