Module: SimpleCov::CLI::Show::Sweep
Instance Method Summary collapse
- #display_path(filename) ⇒ Object
- #emit(rows, opts, stdout, stderr) ⇒ Object
- #misses(coverage) ⇒ Object
Instance Method Details
#display_path(filename) ⇒ Object
30 31 32 |
# File 'lib/simplecov/cli/show/sweep.rb', line 30 def display_path(filename) filename.delete_prefix("#{File.(SimpleCov.root)}/") end |
#emit(rows, opts, stdout, stderr) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/simplecov/cli/show/sweep.rb', line 19 def emit(rows, opts, stdout, stderr) if opts.fetch(:json) stdout.puts(JSON.pretty_generate(rows.map { |path, missed| {path: path, missed: missed} })) elsif rows.empty? stderr.puts("simplecov show: nothing uncovered") else rows.each { |path, missed| stdout.puts("#{path}:#{Patch::Output.ranges(missed, ",")}") } end 0 end |
#misses(coverage) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/simplecov/cli/show/sweep.rb', line 9 def misses(coverage) rows = coverage.filter_map do |filename, entry| next unless entry.instance_of?(Hash) && entry["lines"].instance_of?(Array) missed = Annotator.missed_lines(entry) [display_path(filename), missed] unless missed.empty? end rows.sort_by(&:first) end |