Class: SimpleCov::FileList
- Inherits:
 - 
      Object
      
        
- Object
 - SimpleCov::FileList
 
 
- Extended by:
 - Forwardable
 
- Includes:
 - Enumerable
 
- 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
- #branch_covered_percent ⇒ Object
 - #coverage_statistics ⇒ Object
 - #coverage_statistics_by_file ⇒ Object
 - 
  
    
      #covered_branches  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Return total count of covered branches.
 - 
  
    
      #covered_lines  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the count of lines that have coverage.
 - 
  
    
      #covered_percent  ⇒ Float 
    
    
  
  
  
  
  
  
  
  
  
    
Computes the coverage based upon lines covered and lines missed.
 - 
  
    
      #covered_percentages  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Computes the coverage based upon lines covered and lines missed for each file Returns an array with all coverage percentages.
 - 
  
    
      #covered_strength  ⇒ Float 
    
    
  
  
  
  
  
  
  
  
  
    
Computes the strength (hits / line) based upon lines covered and lines missed.
 - 
  
    
      #initialize(files)  ⇒ FileList 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of FileList.
 - 
  
    
      #least_covered_file  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Finds the least covered file and returns that file’s name.
 - 
  
    
      #lines_of_code  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the overall amount of relevant lines of code across all files in this list.
 - 
  
    
      #missed_branches  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Return total count of covered branches.
 - 
  
    
      #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.
 - 
  
    
      #total_branches  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Return total count of branches in all files.
 
Constructor Details
#initialize(files) ⇒ FileList
Returns a new instance of FileList.
      22 23 24  | 
    
      # File 'lib/simplecov/file_list.rb', line 22 def initialize(files) @files = files end  | 
  
Instance Method Details
#branch_covered_percent ⇒ Object
      101 102 103  | 
    
      # File 'lib/simplecov/file_list.rb', line 101 def branch_covered_percent coverage_statistics[:branch]&.percent end  | 
  
#coverage_statistics ⇒ Object
      26 27 28  | 
    
      # File 'lib/simplecov/file_list.rb', line 26 def coverage_statistics @coverage_statistics ||= compute_coverage_statistics end  | 
  
#coverage_statistics_by_file ⇒ Object
      30 31 32  | 
    
      # File 'lib/simplecov/file_list.rb', line 30 def coverage_statistics_by_file @coverage_statistics_by_file ||= compute_coverage_statistics_by_file end  | 
  
#covered_branches ⇒ Object
Return total count of covered branches
      92 93 94  | 
    
      # File 'lib/simplecov/file_list.rb', line 92 def covered_branches coverage_statistics[:branch]&.covered end  | 
  
#covered_lines ⇒ Object
Returns the count of lines that have coverage
      35 36 37  | 
    
      # File 'lib/simplecov/file_list.rb', line 35 def covered_lines coverage_statistics[:line]&.covered end  | 
  
#covered_percent ⇒ Float
Computes the coverage based upon lines covered and lines missed
      76 77 78  | 
    
      # File 'lib/simplecov/file_list.rb', line 76 def covered_percent coverage_statistics[:line]&.percent end  | 
  
#covered_percentages ⇒ Object
Computes the coverage based upon lines covered and lines missed for each file Returns an array with all coverage percentages
      60 61 62  | 
    
      # File 'lib/simplecov/file_list.rb', line 60 def covered_percentages map(&:covered_percent) end  | 
  
#covered_strength ⇒ Float
Computes the strength (hits / line) based upon lines covered and lines missed
      82 83 84  | 
    
      # File 'lib/simplecov/file_list.rb', line 82 def covered_strength coverage_statistics[:line]&.strength end  | 
  
#least_covered_file ⇒ Object
Finds the least covered file and returns that file’s name
      65 66 67  | 
    
      # File 'lib/simplecov/file_list.rb', line 65 def least_covered_file min_by(&:covered_percent).filename end  | 
  
#lines_of_code ⇒ Object
Returns the overall amount of relevant lines of code across all files in this list
      70 71 72  | 
    
      # File 'lib/simplecov/file_list.rb', line 70 def lines_of_code coverage_statistics[:line]&.total end  | 
  
#missed_branches ⇒ Object
Return total count of covered branches
      97 98 99  | 
    
      # File 'lib/simplecov/file_list.rb', line 97 def missed_branches coverage_statistics[:branch]&.missed end  | 
  
#missed_lines ⇒ Object
Returns the count of lines that have been missed
      40 41 42  | 
    
      # File 'lib/simplecov/file_list.rb', line 40 def missed_lines coverage_statistics[:line]&.missed end  | 
  
#never_lines ⇒ Object
Returns the count of lines that are not relevant for coverage
      45 46 47 48 49  | 
    
      # File 'lib/simplecov/file_list.rb', line 45 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
      52 53 54 55 56  | 
    
      # File 'lib/simplecov/file_list.rb', line 52 def skipped_lines return 0.0 if empty? map { |f| f.skipped_lines.count }.inject(:+) end  | 
  
#total_branches ⇒ Object
Return total count of branches in all files
      87 88 89  | 
    
      # File 'lib/simplecov/file_list.rb', line 87 def total_branches coverage_statistics[:branch]&.total end  |