Class: SimpleCov::FileList
- Inherits:
-
Array
- Object
- Array
- SimpleCov::FileList
- Defined in:
- lib/simplecov/file_list.rb
Overview
An array of SimpleCov SourceFile instances with additional collection helper methods for calculating coverage across them etc.
Instance Method Summary collapse
-
#covered_lines ⇒ Object
Returns the count of lines that have coverage.
-
#covered_percent ⇒ Object
Computes the coverage based upon lines covered and lines missed.
-
#covered_strength ⇒ Object
Computes the strength (hits / line) based upon lines covered and lines missed.
-
#lines_of_code ⇒ Object
Returns the overall amount of relevant lines of code across all files in this list.
-
#missed_lines ⇒ Object
Returns the count of lines that have been missed.
-
#never_lines ⇒ Object
Returns the count of lines that are not relevant for coverage.
-
#skipped_lines ⇒ Object
Returns the count of skipped lines.
Instance Method Details
#covered_lines ⇒ Object
Returns the count of lines that have coverage
5 6 7 8 |
# File 'lib/simplecov/file_list.rb', line 5 def covered_lines return 0.0 if empty? map {|f| f.covered_lines.count }.inject(&:+) end |
#covered_percent ⇒ Object
Computes the coverage based upon lines covered and lines missed
34 35 36 37 |
# File 'lib/simplecov/file_list.rb', line 34 def covered_percent return 100.0 if empty? or lines_of_code == 0 covered_lines * 100.0 / lines_of_code end |
#covered_strength ⇒ Object
Computes the strength (hits / line) based upon lines covered and lines missed
40 41 42 43 |
# File 'lib/simplecov/file_list.rb', line 40 def covered_strength return 0 if empty? or lines_of_code == 0 map {|f| f.covered_strength }.inject(&:+) / size end |
#lines_of_code ⇒ Object
Returns the overall amount of relevant lines of code across all files in this list
29 30 31 |
# File 'lib/simplecov/file_list.rb', line 29 def lines_of_code covered_lines + missed_lines end |
#missed_lines ⇒ Object
Returns the count of lines that have been missed
11 12 13 14 |
# File 'lib/simplecov/file_list.rb', line 11 def missed_lines return 0.0 if empty? map {|f| f.missed_lines.count }.inject(&:+) end |
#never_lines ⇒ Object
Returns the count of lines that are not relevant for coverage
17 18 19 20 |
# File 'lib/simplecov/file_list.rb', line 17 def never_lines return 0.0 if empty? map {|f| f.never_lines.count }.inject(&:+) end |
#skipped_lines ⇒ Object
Returns the count of skipped lines
23 24 25 26 |
# File 'lib/simplecov/file_list.rb', line 23 def skipped_lines return 0.0 if empty? map {|f| f.skipped_lines.count }.inject(&:+) end |