Sha256: 9ea3bd4a4cb675e05e7ddf1cc856a1df5b76743b842090e345296f6ac1eb0502

Contents?: true

Size: 686 Bytes

Versions: 13

Compression:

Stored size: 686 Bytes

Contents

# frozen_string_literal: true

module DeepCover
  class Analyser::PerLine < Analyser
    # Returns an array of runs, one per line.
    def results
      disallow_partial = !options.fetch(:allow_partial, true)
      line_hits = Array.new(covered_code.nb_lines + covered_code.lineno - 1)
      each_node do |node|
        next unless (runs = node_runs(node))
        node.executed_locs.each do |loc|
          lineno = loc.line - 1
          if disallow_partial
            line_hits[lineno] = 0 if runs == 0
            next if line_hits[lineno] == 0
          end
          line_hits[lineno] = [line_hits[lineno] || 0, runs].max
        end
      end

      line_hits
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
deep-cover-0.6.0 lib/deep_cover/analyser/per_line.rb
deep-cover-0.5.7 lib/deep_cover/analyser/per_line.rb
deep-cover-0.5.6 lib/deep_cover/analyser/per_line.rb
deep-cover-0.5.5 lib/deep_cover/analyser/per_line.rb
deep-cover-0.5.4 lib/deep_cover/analyser/per_line.rb
deep-cover-0.5.3 lib/deep_cover/analyser/per_line.rb
deep-cover-0.5.2 lib/deep_cover/analyser/per_line.rb
deep-cover-0.5.1 lib/deep_cover/analyser/per_line.rb
deep-cover-0.5.0 lib/deep_cover/analyser/per_line.rb
deep-cover-0.4.0 lib/deep_cover/analyser/per_line.rb
deep-cover-0.3.0 lib/deep_cover/analyser/per_line.rb
deep-cover-0.2.0 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.16 lib/deep_cover/analyser/per_line.rb