Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error on negative counts with no function_name. #100

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions fastcov.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
Expand Down Expand Up @@ -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:
Expand Down
Loading