Sha256: e85007fa70193c77d810667f1caf9bb30185999de640c7cedd6edf033ae884e1

Contents?: true

Size: 662 Bytes

Versions: 15

Compression:

Stored size: 662 Bytes

Contents

# frozen_string_literal: true

module Reek
  module Report
    #
    # Basic formatter that just shows a simple message for each warning,
    # prepended with the result of the passed-in location formatter.
    #
    class SimpleWarningFormatter
      def initialize(location_formatter: BlankLocationFormatter)
        @location_formatter = location_formatter
      end

      def format(warning)
        "#{location_formatter.format(warning)}#{warning.base_message}"
      end

      def format_list(warnings)
        warnings.map { |warning| "  #{format(warning)}" }.join("\n")
      end

      private

      attr_reader :location_formatter
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
reek-6.4.0 lib/reek/report/simple_warning_formatter.rb
reek-6.3.0 lib/reek/report/simple_warning_formatter.rb
reek-6.2.0 lib/reek/report/simple_warning_formatter.rb
reek-6.1.4 lib/reek/report/simple_warning_formatter.rb
reek-6.1.3 lib/reek/report/simple_warning_formatter.rb
reek-6.1.2 lib/reek/report/simple_warning_formatter.rb
reek-6.1.1 lib/reek/report/simple_warning_formatter.rb
reek-6.1.0 lib/reek/report/simple_warning_formatter.rb
reek-6.0.6 lib/reek/report/simple_warning_formatter.rb
reek-6.0.5 lib/reek/report/simple_warning_formatter.rb
reek-6.0.4 lib/reek/report/simple_warning_formatter.rb
reek-6.0.3 lib/reek/report/simple_warning_formatter.rb
reek-6.0.2 lib/reek/report/simple_warning_formatter.rb
reek-6.0.1 lib/reek/report/simple_warning_formatter.rb
reek-6.0.0 lib/reek/report/simple_warning_formatter.rb