Sha256: bc7fa5e1e46291734d8b964ef57bf2bbedf346738fd3412551bcbdb320bd8ec8

Contents?: true

Size: 1.08 KB

Versions: 17

Compression:

Stored size: 1.08 KB

Contents

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

17 entries across 17 versions & 1 rubygems

Version Path
reek-3.11 lib/reek/report/heading_formatter.rb
reek-3.10.2 lib/reek/report/heading_formatter.rb
reek-3.10.1 lib/reek/report/heading_formatter.rb
reek-3.10.0 lib/reek/report/heading_formatter.rb
reek-3.9.1 lib/reek/report/heading_formatter.rb
reek-3.9.0 lib/reek/report/heading_formatter.rb
reek-3.8.3 lib/reek/report/heading_formatter.rb
reek-3.8.2 lib/reek/report/heading_formatter.rb
reek-3.8.1 lib/reek/report/heading_formatter.rb
reek-3.8.0 lib/reek/report/heading_formatter.rb
reek-3.7.1 lib/reek/report/heading_formatter.rb
reek-3.7.0 lib/reek/report/heading_formatter.rb
reek-3.6.1 lib/reek/report/heading_formatter.rb
reek-3.6.0 lib/reek/report/heading_formatter.rb
reek-3.5.0 lib/reek/report/heading_formatter.rb
reek-3.4.1 lib/reek/report/heading_formatter.rb
reek-3.4.0 lib/reek/report/heading_formatter.rb