Sha256: 4a63208d0478197af61b05ebd5820006def86e0770faa304d2ec397d21e5abaa

Contents?: true

Size: 953 Bytes

Versions: 9

Compression:

Stored size: 953 Bytes

Contents

# frozen_string_literal: true
module Reek
  module Report
    module Formatter
      #
      # 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
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
reek-4.6.1 lib/reek/report/formatter/location_formatter.rb
reek-4.6.0 lib/reek/report/formatter/location_formatter.rb
reek-4.5.6 lib/reek/report/formatter/location_formatter.rb
reek-4.5.5 lib/reek/report/formatter/location_formatter.rb
reek-4.5.4 lib/reek/report/formatter/location_formatter.rb
reek-4.5.3 lib/reek/report/formatter/location_formatter.rb
reek-4.5.2 lib/reek/report/formatter/location_formatter.rb
reek-4.5.1 lib/reek/report/formatter/location_formatter.rb
reek-4.5.0 lib/reek/report/formatter/location_formatter.rb