Skip to content

Commit

Permalink
fix(coverage): Account for SHA in lcov DA parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Borja Lorente committed Jun 4, 2024
1 parent 4c1f3f3 commit a2d698a
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,16 @@ private static TIntIntHashMap parseHits(BufferedReader reader) throws IOExceptio
return hits;
}
if (line.startsWith(DA)) {
// DA:line,hits
int comma = line.indexOf(',');
// DA:line,hits,sha
String[] segments = line.substring(DA.length()).split(",");
if (segments.length < 2) {
logger.warn(String.format("Cannot parse LCOV line: Expected entry to have format DA:<number>,<number>, was: %s", line));
continue;
}
try {
hits.put(
Integer.parseInt(line.substring(DA.length(), comma)),
Integer.parseInt(line.substring(comma + 1)));
Integer.parseInt(segments[0]),
Integer.parseInt(segments[1]));
} catch (NumberFormatException e) {
logger.warn("Cannot parse LCOV line: " + line, e);
}
Expand Down

0 comments on commit a2d698a

Please sign in to comment.