123456789_123456789_123456789_123456789_123456789_

Class: RuboCop::Cop::Commissioner::InvestigationReport

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Struct
Instance Chain:
self, Struct
Inherits: Struct
  • Object
Defined in: lib/rubocop/cop/commissioner.rb

Overview

How a Commissioner returns the results of the investigation as a list of Cop::InvestigationReport and any errors caught during the investigation. Immutable Consider creation API private

Instance Attribute Summary

  • #cop_reports rw

    How a Commissioner returns the results of the investigation as a list of Cop::InvestigationReport and any errors caught during the investigation.

  • #errors rw

    How a Commissioner returns the results of the investigation as a list of Cop::InvestigationReport and any errors caught during the investigation.

  • #processed_source rw

    How a Commissioner returns the results of the investigation as a list of Cop::InvestigationReport and any errors caught during the investigation.

Instance Method Summary

Instance Attribute Details

#cop_reports (rw)

How a Commissioner returns the results of the investigation as a list of Cop::InvestigationReport and any errors caught during the investigation. Immutable Consider creation API private

[ GitHub ]

  
# File 'lib/rubocop/cop/commissioner.rb', line 18

InvestigationReport = Struct.new(:processed_source, :cop_reports, :errors)

#errors (rw)

How a Commissioner returns the results of the investigation as a list of Cop::InvestigationReport and any errors caught during the investigation. Immutable Consider creation API private

[ GitHub ]

  
# File 'lib/rubocop/cop/commissioner.rb', line 18

InvestigationReport = Struct.new(:processed_source, :cop_reports, :errors)

#processed_source (rw)

How a Commissioner returns the results of the investigation as a list of Cop::InvestigationReport and any errors caught during the investigation. Immutable Consider creation API private

[ GitHub ]

  
# File 'lib/rubocop/cop/commissioner.rb', line 18

InvestigationReport = Struct.new(:processed_source, :cop_reports, :errors)

Instance Method Details

#cops

[ GitHub ]

  
# File 'lib/rubocop/cop/commissioner.rb', line 19

def cops
  @cops ||= cop_reports.map(&:cop)
end

#correctors

[ GitHub ]

  
# File 'lib/rubocop/cop/commissioner.rb', line 27

def correctors
  @correctors ||= cop_reports.map(&:corrector)
end

#merge(investigation)

[ GitHub ]

  
# File 'lib/rubocop/cop/commissioner.rb', line 35

def merge(investigation)
  InvestigationReport.new(processed_source,
                          cop_reports + investigation.cop_reports,
                          errors + investigation.errors)
end

#offenses

[ GitHub ]

  
# File 'lib/rubocop/cop/commissioner.rb', line 31

def offenses
  @offenses ||= offenses_per_cop.flatten(1)
end

#offenses_per_cop

[ GitHub ]

  
# File 'lib/rubocop/cop/commissioner.rb', line 23

def offenses_per_cop
  @offenses_per_cop ||= cop_reports.map(&:offenses)
end