Class: RubyCritic::Generator::LintReport

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycritic/generators/lint_report.rb

Instance Method Summary collapse

Constructor Details

#initialize(analysed_modules) ⇒ LintReport

Returns a new instance of LintReport.


8
9
10
# File 'lib/rubycritic/generators/lint_report.rb', line 8

def initialize(analysed_modules)
  @analysed_modules = analysed_modules
end

Instance Method Details

#generate_reportObject


12
13
14
15
16
17
# File 'lib/rubycritic/generators/lint_report.rb', line 12

def generate_report
  FileUtils.mkdir_p(generator.file_directory)
  File.open(generator.file_pathname, 'w+') do |file|
    file.write(reports.join("\n"))
  end
end

#generatorObject


19
20
21
# File 'lib/rubycritic/generators/lint_report.rb', line 19

def generator
  Text::Lint
end

#reportsObject


23
24
25
26
27
# File 'lib/rubycritic/generators/lint_report.rb', line 23

def reports
  @analysed_modules.sort.map do |mod|
    generator.new(mod).render
  end
end