Sha256: bdc80137e567ac6b419fb5bbdd29d8a62b9fc30d1ae33ccc738d1c784049f887

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

require_relative 'base_error'

module Reek
  module Errors
    # Gets raised when Reek is unable to process the source
    class IncomprehensibleSourceError < BaseError
      INCOMPREHENSIBLE_SOURCE_TEMPLATE = <<-MESSAGE.freeze
        !!!
        Source %s cannot be processed by Reek.

        This is most likely either a problem in your Reek configuration (config file or
        source code comments) or a Reek bug.

        Please double check your Reek configuration taking the original exception
        below into account -  you might have misspelled a smell detector for instance.
        (In the future Reek will handle configuration errors more gracefully, something
        we are working on already).

        If you feel that this is not a problem with your Reek configuration but with
        Reek itself it would be great if you could report this back to the Reek
        team by opening up a corresponding issue at https://github.com/troessner/reek/issues.

        Please make sure to include the source in question, the Reek version
        and the original exception below.

        Exception message:

        %s

        Original exception:

        %s

        !!!
      MESSAGE

      def initialize(origin:, original_exception:)
        message = format(INCOMPREHENSIBLE_SOURCE_TEMPLATE,
                         origin,
                         original_exception.message,
                         original_exception.backtrace.join("\n\t"))
        super message
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reek-4.7.3 lib/reek/errors/incomprehensible_source_error.rb