Sha256: 3a831d6fabfd3edad575d111e2bceb3d2765c727a2c0e8dc8c0100d22e14a163

Contents?: true

Size: 1.29 KB

Versions: 63

Compression:

Stored size: 1.29 KB

Contents

# An array of SimpleCov SourceFile instances with additional collection helper
# methods for calculating coverage across them etc.
class SimpleCov::FileList < Array
  # Returns the count of lines that have coverage
  def covered_lines
    return 0.0 if empty?
    map {|f| f.covered_lines.count }.inject(&:+)
  end

  # Returns the count of lines that have been missed
  def missed_lines
    return 0.0 if empty?
    map {|f| f.missed_lines.count }.inject(&:+)
  end

  # Returns the count of lines that are not relevant for coverage
  def never_lines
    return 0.0 if empty?
    map {|f| f.never_lines.count }.inject(&:+)
  end

  # Returns the count of skipped lines
  def skipped_lines
    return 0.0 if empty?
    map {|f| f.skipped_lines.count }.inject(&:+)
  end

  # Returns the overall amount of relevant lines of code across all files in this list
  def lines_of_code
    covered_lines + missed_lines
  end

  # Computes the coverage based upon lines covered and lines missed
  def covered_percent
    return 100.0 if empty? or lines_of_code == 0
    covered_lines * 100.0 / lines_of_code
  end

  # Computes the strength (hits / line) based upon lines covered and lines missed
  def covered_strength
    return 0 if empty? or lines_of_code == 0
    map {|f| f.covered_strength }.inject(&:+) / size
  end
end

Version data entries

63 entries across 48 versions & 6 rubygems

Version Path
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
candlepin-api-0.4.0 bundle/ruby/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
challah-1.0.0 vendor/bundle/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
challah-1.0.0.beta3 vendor/bundle/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
challah-1.0.0.beta2 vendor/bundle/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
challah-1.0.0.beta vendor/bundle/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
challah-0.9.1.beta.3 vendor/bundle/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
devise_sociable-0.1.0 vendor/bundle/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
challah-0.9.1.beta vendor/bundle/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
challah-0.9.0 vendor/bundle/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
challah-rolls-0.2.0 vendor/bundle/gems/simplecov-0.6.4/lib/simplecov/file_list.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/simplecov-0.6.4/lib/simplecov/file_list.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/simplecov-0.6.4/lib/simplecov/file_list.rb
challah-rolls-0.2.0 vendor/bundle/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
challah-0.8.3 vendor/bundle/gems/simplecov-0.6.4/lib/simplecov/file_list.rb
challah-0.8.3 vendor/bundle/gems/simplecov-0.7.1/lib/simplecov/file_list.rb
simplecov-0.7.1 lib/simplecov/file_list.rb