lib/rubycritic/report_generators/file_generator.rb in rubycritic-0.0.7 vs lib/rubycritic/report_generators/file_generator.rb in rubycritic-0.0.8

- old
+ new

@@ -4,12 +4,11 @@ module Rubycritic class FileGenerator < BaseGenerator LINE_NUMBER_OFFSET = 1 - FILE_TEMPLATE = ERB.new(File.read(File.join(TEMPLATES_DIR, "file.html.erb"))) - LAYOUT_TEMPLATE = ERB.new(File.read(File.join(TEMPLATES_DIR, "layouts", "application.html.erb"))) + TEMPLATE = ERB.new(File.read(File.join(TEMPLATES_DIR, "file.html.erb"))) def initialize(pathname, smells) @pathname = pathname @smells = smells end @@ -32,11 +31,15 @@ location = Location.new(@pathname, line_number) line_smells = @smells.select { |smell| smell.located_in?(location) } file_code << LineGenerator.new(line_text, line_smells).render end - file_body = FILE_TEMPLATE.result(get_binding { file_code }) + file_body = TEMPLATE.result(get_binding { file_code }) LAYOUT_TEMPLATE.result(get_binding { file_body }) + end + + def file_has_smells? + !@smells.empty? end end end