Sha256: 3bda667ad5e004a74976329262d56a234317adb978c0bdb2caf6aca757f2a1d3
Contents?: true
Size: 1.08 KB
Versions: 8
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module DeepCover silence_warnings do require 'with_progress' end module Tools::DumpCoveredCode def dump_covered_code(source_path, coverage:, dest_path: Dir.mktmpdir) source_path = File.join(File.expand_path(source_path), '') dest_path = File.join(File.expand_path(dest_path), '') skipped = [] file_paths = Dir.glob("#{source_path}**/*.rb").select { |p| File.file?(p) } file_paths.each.with_progress(title: 'Rewriting') do |path| new_path = Pathname(path.gsub(source_path, dest_path)) begin covered_code = coverage.covered_code(path) rescue Parser::SyntaxError skipped << path next end new_path.dirname.mkpath new_path.write(covered_code.covered_source) end unless skipped.empty? warn [ "#{skipped.size} files could not be instrumented because of syntax errors:", *skipped.first(3), ('...' if skipped.size > 3), ].compact.join("\n") end dest_path end end end
Version data entries
8 entries across 8 versions & 1 rubygems