Sha256: bd7bb6e09461e16ae9d756ec01dc248269daef1d0bf164b6bb0feb5cfefa0ab6

Contents?: true

Size: 866 Bytes

Versions: 19

Compression:

Stored size: 866 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.sort.first}: "
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
reek-4.4.2 lib/reek/report/location_formatter.rb
reek-4.4.1 lib/reek/report/location_formatter.rb
reek-4.4.0 lib/reek/report/location_formatter.rb
reek-4.3.0 lib/reek/report/location_formatter.rb
reek-4.2.5 lib/reek/report/location_formatter.rb
reek-4.2.4 lib/reek/report/location_formatter.rb
reek-4.2.3 lib/reek/report/location_formatter.rb
reek-4.2.2 lib/reek/report/location_formatter.rb
reek-4.2.1 lib/reek/report/location_formatter.rb
reek-4.2.0 lib/reek/report/location_formatter.rb
reek-4.1.1 lib/reek/report/location_formatter.rb
reek-4.1.0 lib/reek/report/location_formatter.rb
reek-4.0.5 lib/reek/report/location_formatter.rb
reek-4.0.4 lib/reek/report/location_formatter.rb
reek-4.0.3 lib/reek/report/location_formatter.rb
reek-4.0.2 lib/reek/report/location_formatter.rb
reek-4.0.1 lib/reek/report/location_formatter.rb
reek-4.0.0 lib/reek/report/location_formatter.rb
reek-4.0.0.pre1 lib/reek/report/location_formatter.rb