Sha256: 883f2390c5d8200d351eb11d473cdc696676ea1464c39bf4325a1a8154ef3362

Contents?: true

Size: 659 Bytes

Versions: 13

Compression:

Stored size: 659 Bytes

Contents

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)
      each_node do |node, _children|
        if (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
      end

      line_hits
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
deep-cover-0.1.13 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.12 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.11 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.10 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.9 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.8 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.7 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.6 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.5 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.4 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.3 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.2 lib/deep_cover/analyser/per_line.rb
deep-cover-0.1.1 lib/deep_cover/analyser/per_line.rb