-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add experimental support to profdata file format
- Loading branch information
1 parent
4309008
commit 5cd2399
Showing
15 changed files
with
492 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
module Slather | ||
module CoverageInfo | ||
|
||
def num_lines_tested | ||
line_coverage_data.compact.select { |cd| cd > 0 }.count | ||
end | ||
|
||
def num_lines_testable | ||
line_coverage_data.compact.count | ||
end | ||
|
||
def rate_lines_tested | ||
if num_lines_testable > 0 | ||
(num_lines_tested / num_lines_testable.to_f) | ||
else | ||
0 | ||
end | ||
end | ||
|
||
def percentage_lines_tested | ||
if num_lines_testable == 0 | ||
100 | ||
else | ||
rate_lines_tested * 100 | ||
end | ||
end | ||
|
||
def branch_coverage_data_for_statement_on_line(line_number) | ||
branch_coverage_data[line_number] || [] | ||
end | ||
|
||
def num_branches_for_statement_on_line(line_number) | ||
branch_coverage_data_for_statement_on_line(line_number).length | ||
end | ||
|
||
def num_branch_hits_for_statement_on_line(line_number) | ||
branch_coverage_data_for_statement_on_line(line_number).count { |hit_count| hit_count > 0 } | ||
end | ||
|
||
def rate_branch_coverage_for_statement_on_line(line_number) | ||
branch_data = branch_coverage_data_for_statement_on_line(line_number) | ||
if branch_data.empty? | ||
0.0 | ||
else | ||
(num_branch_hits_for_statement_on_line(line_number) / branch_data.length.to_f) | ||
end | ||
end | ||
|
||
def percentage_branch_coverage_for_statement_on_line(line_number) | ||
rate_branch_coverage_for_statement_on_line(line_number) * 100 | ||
end | ||
|
||
def num_branches_testable | ||
branch_coverage_data.keys.reduce(0) do |sum, line_number| | ||
sum += num_branches_for_statement_on_line(line_number) | ||
end | ||
end | ||
|
||
def num_branches_tested | ||
branch_coverage_data.keys.reduce(0) do |sum, line_number| | ||
sum += num_branch_hits_for_statement_on_line(line_number) | ||
end | ||
end | ||
|
||
def rate_branches_tested | ||
if (num_branches_testable > 0) | ||
(num_branches_tested / num_branches_testable.to_f) | ||
else | ||
0.0 | ||
end | ||
end | ||
|
||
def source_file_pathname_relative_to_repo_root | ||
source_file_pathname.realpath.relative_path_from(Pathname("./").realpath) | ||
end | ||
|
||
def ignored? | ||
project.ignore_list.any? do |ignore| | ||
File.fnmatch(ignore, source_file_pathname_relative_to_repo_root) | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/slather/coveralls_coverage_file.rb → lib/slather/coveralls_coverage.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Slather | ||
class CoverallsCoverageFile < CoverageFile | ||
module CoverallsCoverage | ||
|
||
def as_json | ||
{ | ||
|
Oops, something went wrong.