Sha256: 8c8379528cb77f55f35c5bca8d138ca24fad57569dcb775ddb64c48dd76fcf01

Contents?: true

Size: 947 Bytes

Versions: 5

Compression:

Stored size: 947 Bytes

Contents

# frozen_string_literal: true

require 'rubycritic/generators/html/base'

module RubyCritic
  module Generator
    module Html
      class SmellsIndex < Base
        TEMPLATE = erb_template('smells_index.html.erb')

        def initialize(analysed_modules)
          @smells = analysed_modules.flat_map(&:smells).uniq
          @analysed_module_names = analysed_module_names(analysed_modules)
          @show_status = (Config.mode == :default)
        end

        def file_name
          'smells_index.html'
        end

        def render
          index_body = TEMPLATE.result(get_binding)
          LAYOUT_TEMPLATE.result(get_binding { index_body })
        end

        private

        def analysed_module_names(analysed_modules)
          names = {}
          analysed_modules.each do |analysed_module|
            names[analysed_module.pathname] = analysed_module.name
          end
          names
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubycritic-3.4.0 lib/rubycritic/generators/html/smells_index.rb
rubycritic-3.3.0 lib/rubycritic/generators/html/smells_index.rb
rubycritic-3.2.3 lib/rubycritic/generators/html/smells_index.rb
rubycritic-3.2.2 lib/rubycritic/generators/html/smells_index.rb
rubycritic-3.2.1 lib/rubycritic/generators/html/smells_index.rb