Sha256: 605867f22ab30e2116c03c3d72398521032ccb5f8020c8d8b5bfd21b6ef2c64f

Contents?: true

Size: 971 Bytes

Versions: 3

Compression:

Stored size: 971 Bytes

Contents

module Reek
  module CLI
    module Report
      module HeadingFormatter
        #
        # Base class for heading formatters.
        # Is responsible for formatting the heading emitted for each examiner
        #
        class Base
          attr_reader :report_formatter

          def initialize(report_formatter)
            @report_formatter = report_formatter
          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
          def show_header?(examiner)
            examiner.smelly?
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reek-2.2.1 lib/reek/cli/report/heading_formatter.rb
reek-2.2.0 lib/reek/cli/report/heading_formatter.rb
reek-2.1.0 lib/reek/cli/report/heading_formatter.rb