Skip to content

Commit

Permalink
target using serialized line coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
nakiostudio committed Jun 9, 2018
1 parent 1dc932f commit 2c68bfb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/xcov/model/target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class Target < Xcov::Base
attr_accessor :files
attr_accessor :file_templates

def initialize(name, files)
def initialize(name, coverage, files)
@name = CGI::escapeHTML(name)
@files = files
@coverage = files.count == 0 ? 0.0 : files.reduce(0) { |acc, file| acc + file.coverage.to_f } / files.count
@coverage = coverage
@displayable_coverage = self.create_displayable_coverage
@coverage_color = self.create_coverage_color
@id = Target.create_id(name)
Expand Down Expand Up @@ -53,11 +53,12 @@ def json_value

def self.map(dictionary)
name = dictionary["name"]
coverage = dictionary["coverage"]
files = dictionary["files"].map { |file| Source.map(file)}
files = files.sort &by_coverage_with_ignored_at_the_end
non_ignored_files = Target.select_non_ignored_files(files)

Target.new(name, non_ignored_files)
Target.new(name, coverage, non_ignored_files)
end

def self.by_coverage_with_ignored_at_the_end
Expand Down

0 comments on commit 2c68bfb

Please sign in to comment.