Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#130 Revert "target using serialized line coverage" #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 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, coverage, files)
def initialize(name, files)
@name = CGI::escapeHTML(name)
@files = files
@coverage = coverage
@coverage = files.count == 0 ? 0.0 : files.reduce(0) { |acc, file| acc + file.coverage.to_f } / files.count
@displayable_coverage = self.create_displayable_coverage
@coverage_color = self.create_coverage_color
@id = Target.create_id(name)
Expand Down Expand Up @@ -53,12 +53,11 @@ 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, coverage, non_ignored_files)
Target.new(name, non_ignored_files)
end

def self.by_coverage_with_ignored_at_the_end
Expand Down