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

Inherits:
Struct
  • Object
show all
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 collapse

Instance Method Summary collapse

Instance Attribute Details

#cop_reportsObject

Returns the value of attribute cop_reports

Returns:

  • (Object)

    the current value of cop_reports


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

def cop_reports
  @cop_reports
end

#errorsObject

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors


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

def errors
  @errors
end

#processed_sourceObject

Returns the value of attribute processed_source

Returns:

  • (Object)

    the current value of processed_source


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

def processed_source
  @processed_source
end

Instance Method Details

#copsObject


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

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

#correctorsObject


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

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

#merge(investigation) ⇒ Object


35
36
37
38
39
# File 'lib/rubocop/cop/commissioner.rb', line 35

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

#offensesObject


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

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

#offenses_per_copObject


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

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