Module: RubyCritic::Reporter

Defined in:
lib/rubycritic/reporter.rb

Constant Summary collapse

REPORT_GENERATOR_CLASS_FORMATS =
%i[json console lint].freeze

Class Method Summary collapse

Class Method Details

.generate_report(analysed_modules) ⇒ Object



7
8
9
10
11
# File 'lib/rubycritic/reporter.rb', line 7

def self.generate_report(analysed_modules)
  Config.formats.uniq.each do |format|
    report_generator_class(format).new(analysed_modules).generate_report
  end
end

.report_generator_class(config_format) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/rubycritic/reporter.rb', line 13

def self.report_generator_class(config_format)
  if REPORT_GENERATOR_CLASS_FORMATS.include? config_format
    require "rubycritic/generators/#{config_format}_report"
    Generator.const_get("#{config_format.capitalize}Report")
  else
    require 'rubycritic/generators/html_report'
    Generator::HtmlReport
  end
end