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

Don't generate line 0 in profdata_coverage_file.rb from line with error #387

Closed
Closed
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
12 changes: 11 additions & 1 deletion lib/slather/profdata_coverage_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,17 @@ def source_file
end

def source_code_lines
self.source.split("\n")[(path_on_first_line? ? 1 : 0)..-1]
lines = self.source.split("\n")[(path_on_first_line? ? 1 : 0)..-1]
if self.line_numbers_first
lines = lines.select do |line|
# Ignore crash / error lines in format like
# ------------------
# | Unexecuted instantiation: _Something
# ------------------
!(line.lstrip.start_with?("|") || line.lstrip.start_with?("--"))
end
end
lines
end

def source_data
Expand Down