Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error on negative counts with no function_name.
Browse files Browse the repository at this point in the history
wsnyder committed Jul 26, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent c80ad2b commit 01826c0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fastcov.py
Original file line number Diff line number Diff line change
@@ -254,14 +254,14 @@ def processPrefix(path, prefix, prefix_strip):
p = Path(path)
if p.exists() or not p.is_absolute():
return path

if prefix_strip > 0:
segments = p.parts

if len(segments) < prefix_strip + 1:
logging.warning("Couldn't strip %i path levels from %s.", prefix_strip, path)
return path

segments = segments[prefix_strip+1:]
p = Path(segments[0])
segments = segments[1:]
@@ -674,7 +674,10 @@ def distillLine(line_raw, lines, branches, include_exceptional_branches):
line_number = int(line_raw["line_number"])
count = int(line_raw["count"])
if count < 0:
logging.warning("Ignoring negative count found in %s.", line_raw["function_name"])
if "function_name" in line_raw:
logging.warning("Ignoring negative count found in %s.", line_raw["function_name"])
else:
logging.warning("Ignoring negative count.")
count = 0

if line_number not in lines:

0 comments on commit 01826c0

Please sign in to comment.