| 75 | } |
| 76 | |
| 77 | void cmSarif::ResultsLog::LogMessage( |
| 78 | MessageType t, std::string const& text, |
| 79 | cmListFileBacktrace const& backtrace) const |
| 80 | { |
| 81 | // Add metadata to the result object |
| 82 | // The CMake SARIF rules for messages all expect 1 string argument with the |
| 83 | // message text |
| 84 | Json::Value additionalProperties(Json::objectValue); |
| 85 | Json::Value args(Json::arrayValue); |
| 86 | args.append(text); |
| 87 | additionalProperties["message"]["id"] = "default"; |
| 88 | additionalProperties["message"]["arguments"] = args; |
| 89 | |
| 90 | // Create and log a result object |
| 91 | // Rule indices are assigned when writing the final JSON output. Right now, |
| 92 | // leave it as nullopt. The other optional fields are filled if available |
| 93 | this->Log(cmSarif::Result{ |
| 94 | text, cmSarif::SourceFileLocation::FromBacktrace(backtrace), |
| 95 | cmSarif::MessageSeverityLevel(t), cmSarif::MessageRuleId(t), cm::nullopt, |
| 96 | additionalProperties }); |
| 97 | } |
| 98 | |
| 99 | std::size_t cmSarif::ResultsLog::UseRule(std::string const& id) const |
| 100 | { |
no test coverage detected