-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
h/t @aitap for highlighting this:
See docs:
https://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html
And thankfully we already import {jsonlite}:
Line 51 in d8d33b4
| jsonlite, |
Currently, gcov output is parsed with regular expressions:
Lines 18 to 37 in d8d33b4
| re <- rex::rex(any_spaces, | |
| capture(name = "coverage", some_of(digit, "-", "#", "=")), | |
| ":", any_spaces, | |
| capture(name = "line", digits), | |
| ":" | |
| ) | |
| matches <- rex::re_matches(lines, re) | |
| # Exclude lines with no match to the pattern | |
| lines <- lines[!is.na(matches$coverage)] | |
| matches <- na.omit(matches) | |
| # gcov lines which have no coverage | |
| matches$coverage[matches$coverage == "#####"] <- 0 # nolint | |
| # gcov lines which have parse error, so make untracked | |
| matches$coverage[matches$coverage == "====="] <- "-" | |
| coverage_lines <- matches$line != "0" & matches$coverage != "-" |
I think it will be much more robust and extensible to use the structured JSON output instead.
Metadata
Metadata
Assignees
Labels
No labels