Skip to content

Commit 12dd645

Browse files
committed
parser-json-cov: process nested events recursively
Closes: #222
1 parent 7626c96 commit 12dd645

8 files changed

+15581
-5157
lines changed

src/lib/parser-json-cov.cc

+5
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ void CovTreeDecoder::Private::readEvents(Defect *def)
101101
// push the event to the list of events
102102
const DefEvent evt = covDecodeEvt(evtNode);
103103
def->events.push_back(std::move(evt));
104+
105+
// check for nested events and eventually process them recursively
106+
const pt::ptree &nestedEvts = evtNode.get_child("events");
107+
if (!nestedEvts.empty())
108+
todo.push(nestedEvts);
104109
}
105110
while (!todo.empty());
106111
}

tests/csgrep/0059-json-parser-cov-v7-cwe-stdout.txt

+101
Large diffs are not rendered by default.

tests/csgrep/0061-json-parser-cov-v7-lang-stdout.txt

+9,602-5,157
Large diffs are not rendered by default.

tests/csgrep/0130-file-glob-stdin.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--mode=json

tests/csgrep/0132-cov-parser-nested-evt-stdin.txt

+4,219
Large diffs are not rendered by default.

tests/csgrep/0132-cov-parser-nested-evt-stdout.txt

+1,652
Large diffs are not rendered by default.

tests/csgrep/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,4 @@ test_csgrep("0128-cov-parser-noloc" )
175175
test_csgrep("0129-sarif-gcc-pwd" )
176176
test_csgrep("0130-file-glob" )
177177
test_csgrep("0131-unicontrol-perl-man-page" )
178+
test_csgrep("0132-cov-parser-nested-evt" )

0 commit comments

Comments
 (0)