Skip to content

Commit 008b496

Browse files
frabertxlauko
authored andcommitted
pr: Emit maybeparse operations in SARIF files
1 parent 8a06e24 commit 008b496

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tools/vast-detect-parsers/ParserCategoryDetector.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,25 @@ namespace vast {
6464
}
6565
results.push_back(result);
6666
});
67+
68+
getOperation().walk([&](pr::MaybeParse op) {
69+
gap::sarif::result result{
70+
.ruleId{ "pr-maybeparse" },
71+
.ruleIndex = 0,
72+
.kind = gap::sarif::kind::kInformational,
73+
.level = gap::sarif::level::kNote,
74+
.message{
75+
.text{ { "Potential parsing operation detected" } },
76+
},
77+
.locations{},
78+
};
79+
if (auto loc = cc::sarif::mk_location(op.getLoc());
80+
loc.physicalLocation.has_value())
81+
{
82+
result.locations.push_back(std::move(loc));
83+
}
84+
results.push_back(result);
85+
});
6786
}
6887
} // namespace vast
6988
#endif

0 commit comments

Comments
 (0)