Sha256: 65f563868c3f73924ab7522ff709c0562769833c1fb87053b11dbb2bc8340eff

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

module Reek
  module Errors
    # Gets raised when trying to use a configuration for a detector
    # that can't be parsed into a hash.
    class GarbageDetectorConfigurationInCommentError < RuntimeError
      BAD_DETECTOR_CONFIGURATION_MESSAGE = <<-EOS.freeze

        Error: You are trying to configure the smell detector '%s'.
        Unfortunately we can not parse the configuration you have given.
        The source is '%s' and the comment belongs to the expression starting in line %d.
        Here's the original comment:

        %s

        Please see the Reek docs for:
          * how to configure Reek via source code comments: https://github.com/troessner/reek/blob/master/docs/Smell-Suppression.md
          * what smell detectors are available: https://github.com/troessner/reek/blob/master/docs/Code-Smells.md
        Update the offensive comment (or remove it if no longer applicable) and re-run Reek.

      EOS

      def initialize(detector_name:, source:, line:, original_comment:)
        message = format(BAD_DETECTOR_CONFIGURATION_MESSAGE,
                         detector_name,
                         source,
                         line,
                         original_comment)
        super message
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
reek-4.5.5 lib/reek/errors/garbage_detector_configuration_in_comment_error.rb
reek-4.5.4 lib/reek/errors/garbage_detector_configuration_in_comment_error.rb
reek-4.5.3 lib/reek/errors/garbage_detector_configuration_in_comment_error.rb
reek-4.5.2 lib/reek/errors/garbage_detector_configuration_in_comment_error.rb
reek-4.5.1 lib/reek/errors/garbage_detector_configuration_in_comment_error.rb
reek-4.5.0 lib/reek/errors/garbage_detector_configuration_in_comment_error.rb