Sha256: 923af2ca8f5812e3a31d177833ced6a923e4fa4c2632b94c3e883dff1e9c8758

Contents?: true

Size: 861 Bytes

Versions: 16

Compression:

Stored size: 861 Bytes

Contents

# frozen_string_literal: true

require_relative 'code_climate/code_climate_formatter'

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

      # @quality :reek:UtilityFunction
      def format_code_climate_hash(warning)
        CodeClimateFormatter.new(warning).render
      end

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

      private

      attr_reader :location_formatter
    end
  end
end

Version data entries

16 entries across 14 versions & 2 rubygems

Version Path
reek-5.6.0 lib/reek/report/simple_warning_formatter.rb
reek-5.5.0 lib/reek/report/simple_warning_formatter.rb
reek-5.4.1 lib/reek/report/simple_warning_formatter.rb
reek-5.4.0 lib/reek/report/simple_warning_formatter.rb
reek-5.3.2 lib/reek/report/simple_warning_formatter.rb
reek-5.3.1 lib/reek/report/simple_warning_formatter.rb
reek-5.3.0 lib/reek/report/simple_warning_formatter.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/report/simple_warning_formatter.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/report/simple_warning_formatter.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/report/simple_warning_formatter.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/report/simple_warning_formatter.rb
reek-5.2.0 lib/reek/report/simple_warning_formatter.rb
reek-5.1.0 lib/reek/report/simple_warning_formatter.rb
reek-5.0.2 lib/reek/report/simple_warning_formatter.rb
reek-5.0.1 lib/reek/report/simple_warning_formatter.rb
reek-5.0.0 lib/reek/report/simple_warning_formatter.rb