Sha256: db357893b655d09341d4329f3d309b56a407ba90f28040510f41c3e5bc98ab60

Contents?: true

Size: 860 Bytes

Versions: 31

Compression:

Stored size: 860 Bytes

Contents

# frozen_string_literal: true

module Reek
  module Report
    #
    # Formats the location of a warning as an empty string.
    #
    module BlankLocationFormatter
      module_function

      def format(_warning)
        ''
      end
    end

    #
    # Formats the location of a warning as an array of line numbers.
    #
    module DefaultLocationFormatter
      module_function

      def format(warning)
        "#{warning.lines.sort.inspect}:"
      end
    end

    #
    # Formats the location of a warning as a combination of source file name
    # and line number. In this format, it is not possible to show more than
    # one line number, so the first number is displayed.
    #
    module SingleLineLocationFormatter
      module_function

      def format(warning)
        "#{warning.source}:#{warning.lines.min}: "
      end
    end
  end
end

Version data entries

31 entries across 29 versions & 2 rubygems

Version Path
reek-6.4.0 lib/reek/report/location_formatter.rb
reek-6.3.0 lib/reek/report/location_formatter.rb
reek-6.2.0 lib/reek/report/location_formatter.rb
reek-6.1.4 lib/reek/report/location_formatter.rb
reek-6.1.3 lib/reek/report/location_formatter.rb
reek-6.1.2 lib/reek/report/location_formatter.rb
reek-6.1.1 lib/reek/report/location_formatter.rb
reek-6.1.0 lib/reek/report/location_formatter.rb
reek-6.0.6 lib/reek/report/location_formatter.rb
reek-6.0.5 lib/reek/report/location_formatter.rb
reek-6.0.4 lib/reek/report/location_formatter.rb
reek-6.0.3 lib/reek/report/location_formatter.rb
reek-6.0.2 lib/reek/report/location_formatter.rb
reek-6.0.1 lib/reek/report/location_formatter.rb
reek-6.0.0 lib/reek/report/location_formatter.rb
reek-5.6.0 lib/reek/report/location_formatter.rb
reek-5.5.0 lib/reek/report/location_formatter.rb
reek-5.4.1 lib/reek/report/location_formatter.rb
reek-5.4.0 lib/reek/report/location_formatter.rb
reek-5.3.2 lib/reek/report/location_formatter.rb