Sha256: d23430dc502d779635ed04a6815e7639b70a2d7891693da0b95fad24f044d6bb

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true
require_relative 'base_error'

module Reek
  module Errors
    # Gets raised when trying to configure a detector with an option
    # which is unknown to it.
    class BadDetectorConfigurationKeyInCommentError < BaseError
      UNKNOWN_SMELL_DETECTOR_MESSAGE = <<-EOS.freeze

        Error: You are trying to configure the smell detector '%s'
        in one of your source code comments with the unknown option %s.
        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 basic options are available: https://github.com/troessner/reek/blob/master/docs/Basic-Smell-Options.md
          * what custom options are available by checking the detector specific documentation in /docs
        Update the offensive comment (or remove it if no longer applicable) and re-run Reek.

      EOS

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reek-4.6.1 lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb
reek-4.6.0 lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb
reek-4.5.6 lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb