Skip to content

Commit

Permalink
Fix nil pathname
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredofernandes committed Jul 18, 2024
1 parent bc7494c commit 325548c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/slather/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,15 @@ def create_coverage_files(binary_path, path_objects)
if paths_to_segments.key?(coverage_file.source_file_pathname)
coverage_file.segments = paths_to_segments[coverage_file.source_file_pathname]
end
!coverage_file.ignored? && coverage_file.include_file? ? coverage_file : nil
puts "--> coverage_file.source_file_pathname: #{coverage_file.source_file_pathname}"

if coverage_file.source_file_pathname.nil? || coverage_file.source_file_pathname.empty?
puts "--> source_file_pathname is nil or empty, source: #{source}"
else
puts "--> source_file_pathname is not nil or empty"
end

coverage_file.source_file_pathname && !coverage_file.ignored? && coverage_file.include_file? ? coverage_file : nil
end.compact
end
private :create_coverage_files
Expand Down Expand Up @@ -651,7 +659,7 @@ def matches_arch(binary_path)

def find_source_files
source_files = load_option_array("source_files")
return if source_files.nil?
return [] if source_files.nil?

current_dir = Pathname("./").realpath
paths = source_files.flat_map { |pattern| Dir.glob(pattern) }.uniq
Expand Down

0 comments on commit 325548c

Please sign in to comment.