Sha256: d3c5083c09c0676db11a4e03b0795c20643075c294da85d8c3e6422b4cae70d3

Contents?: true

Size: 1.11 KB

Versions: 19

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true
module Reek
  module Report
    module HeadingFormatter
      #
      # Base class for heading formatters.
      # Is responsible for formatting the heading emitted for each examiner
      #
      # @abstract Override {#show_header?} to implement a heading formatter.
      class Base
        attr_reader :report_formatter

        def initialize(report_formatter)
          @report_formatter = report_formatter
        end

        # :reek:UtilityFunction
        def show_header?(_examiner)
          raise NotImplementedError
        end

        def header(examiner)
          if show_header?(examiner)
            report_formatter.header examiner
          else
            ''
          end
        end
      end

      #
      # Lists out each examiner, even if it has no smell
      #
      class Verbose < Base
        def show_header?(_examiner)
          true
        end
      end

      #
      # Lists only smelly examiners
      #
      class Quiet < Base
        # :reek:UtilityFunction
        def show_header?(examiner)
          examiner.smelly?
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
reek-4.4.2 lib/reek/report/heading_formatter.rb
reek-4.4.1 lib/reek/report/heading_formatter.rb
reek-4.4.0 lib/reek/report/heading_formatter.rb
reek-4.3.0 lib/reek/report/heading_formatter.rb
reek-4.2.5 lib/reek/report/heading_formatter.rb
reek-4.2.4 lib/reek/report/heading_formatter.rb
reek-4.2.3 lib/reek/report/heading_formatter.rb
reek-4.2.2 lib/reek/report/heading_formatter.rb
reek-4.2.1 lib/reek/report/heading_formatter.rb
reek-4.2.0 lib/reek/report/heading_formatter.rb
reek-4.1.1 lib/reek/report/heading_formatter.rb
reek-4.1.0 lib/reek/report/heading_formatter.rb
reek-4.0.5 lib/reek/report/heading_formatter.rb
reek-4.0.4 lib/reek/report/heading_formatter.rb
reek-4.0.3 lib/reek/report/heading_formatter.rb
reek-4.0.2 lib/reek/report/heading_formatter.rb
reek-4.0.1 lib/reek/report/heading_formatter.rb
reek-4.0.0 lib/reek/report/heading_formatter.rb
reek-4.0.0.pre1 lib/reek/report/heading_formatter.rb