@@ -241,25 +241,28 @@ static void sarifReadCodeFlow(Defect *pDef, const pt::ptree &cf)
241
241
for (const auto &item : *locs) {
242
242
const pt::ptree &tfLoc = item.second ;
243
243
244
- const pt::ptree *kindList;
245
- if (!findChildOf (&kindList, tfLoc, " kinds" ) || kindList->empty ())
246
- // kind of the event not specified
247
- continue ;
248
-
249
- // concatenate event name
250
244
std::string evtName;
251
- for (const auto &kindItem : *kindList) {
252
- const pt::ptree &kind = kindItem.second ;
253
- if (!evtName.empty ())
254
- evtName += " _" ;
255
- evtName += kind.data ();
245
+ const pt::ptree *kindList;
246
+ if (findChildOf (&kindList, tfLoc, " kinds" )) {
247
+ // calculate event name from the `kinds` list
248
+ for (const auto &kindItem : *kindList) {
249
+ const pt::ptree &kind = kindItem.second ;
250
+ if (!evtName.empty ())
251
+ evtName += " _" ;
252
+ evtName += kind.data ();
253
+ }
256
254
}
257
255
258
256
// append a new event of the specified kind
259
257
events.push_back (DefEvent (evtName));
260
258
DefEvent &evt = events.back ();
261
259
262
- evt.verbosityLevel = valueOf<int >(tfLoc, " nestingLevel" , 1 );
260
+ // read/infer verbosity level
261
+ evt.verbosityLevel = valueOf<int >(tfLoc, " nestingLevel" ,
262
+ (evt.event .empty ())
263
+ ? /* trace */ 2
264
+ : /* info */ 1 );
265
+
263
266
if (!evt.verbosityLevel )
264
267
// update key event
265
268
keyEventIdx = events.size () - 1U ;
@@ -271,6 +274,13 @@ static void sarifReadCodeFlow(Defect *pDef, const pt::ptree &cf)
271
274
272
275
sarifReadLocation (&evt, *loc);
273
276
sarifReadMsg (&evt.msg , *loc);
277
+
278
+ if (evt.event .empty ()) {
279
+ // if no `kind` is given, assume a generic trace event
280
+ evt.event = " path" ;
281
+ if (evt.msg .empty ())
282
+ evt.msg = " generic trace event" ;
283
+ }
274
284
}
275
285
276
286
if (events.size () <= 1U )
0 commit comments