Sha256: 5356d2a4eb6ac7319b2bea38962a85e5dbe4f7260147b885be8ef38830ed97b4

Contents?: true

Size: 1.15 KB

Versions: 21

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require 'rubycritic/generators/html/base'

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

        def initialize(analysed_modules)
          @analysed_modules = sorted(filtered(analysed_modules))
          set_header_links if Config.compare_branches_mode?
        end

        def set_header_links
          @base_path = code_index_path(Config.base_root_directory, file_name)
          @feature_path = code_index_path(Config.feature_root_directory, file_name)
          @build_path = code_index_path(Config.compare_root_directory, file_name)
        end

        def file_name
          'simple_cov_index.html'
        end

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

        def sorted(mods)
          mods.sort_by(&:coverage)
        end

        def filtered(mods)
          mods.reject do |a_module|
            path = a_module.pathname.to_s
            path.start_with?('spec', 'test')
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
rubycritic-4.9.1 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.9.0 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.8.1 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.8.0 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.7.0 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.6.1 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.6.0 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.5.2 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.5.1 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.5.0 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.4.1 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.4.0 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.3.3 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.3.2 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.3.1 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.3.0 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.2.2 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.2.1 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-4.2.0 lib/rubycritic/generators/html/simple_cov_index.rb
rubycritic-simplecov-4.1.1 lib/rubycritic/generators/html/simple_cov_index.rb