Sha256: b7f16504e65574a2af3bbe0da1a8f1ae5d9dea906c4b11b6e82a82ac5aa7fa67

Contents?: true

Size: 1.42 KB

Versions: 28

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

require_relative 'base_error'
require_relative '../documentation_link'

module Reek
  module Errors
    # Gets raised when trying to configure a detector which is unknown to us.
    # This might happen for multiple reasons. The users might have a typo in
    # his comment or he might use a detector that does not exist anymore.
    class BadDetectorInCommentError < BaseError
      UNKNOWN_SMELL_DETECTOR_MESSAGE = <<-MESSAGE

        Error: You are trying to configure an unknown smell detector '%<detector>s' in one
        of your source code comments.
        The source is '%<source>s' and the comment belongs to the expression starting in line %<line>d.
        Here's the original comment:

        %<comment>s

        Please see the Reek docs for:
          * how to configure Reek via source code comments: #{DocumentationLink.build('Smell Suppression')}
          * what smell detectors are available: #{DocumentationLink.build('Code Smells')}
        Update the offensive comment (or remove it if no longer applicable) and re-run Reek.

      MESSAGE

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

Version data entries

28 entries across 26 versions & 2 rubygems

Version Path
reek-6.1.4 lib/reek/errors/bad_detector_in_comment_error.rb
reek-6.1.3 lib/reek/errors/bad_detector_in_comment_error.rb
reek-6.1.2 lib/reek/errors/bad_detector_in_comment_error.rb
reek-6.1.1 lib/reek/errors/bad_detector_in_comment_error.rb
reek-6.1.0 lib/reek/errors/bad_detector_in_comment_error.rb
reek-6.0.6 lib/reek/errors/bad_detector_in_comment_error.rb
reek-6.0.5 lib/reek/errors/bad_detector_in_comment_error.rb
reek-6.0.4 lib/reek/errors/bad_detector_in_comment_error.rb
reek-6.0.3 lib/reek/errors/bad_detector_in_comment_error.rb
reek-6.0.2 lib/reek/errors/bad_detector_in_comment_error.rb
reek-6.0.1 lib/reek/errors/bad_detector_in_comment_error.rb
reek-6.0.0 lib/reek/errors/bad_detector_in_comment_error.rb
reek-5.6.0 lib/reek/errors/bad_detector_in_comment_error.rb
reek-5.5.0 lib/reek/errors/bad_detector_in_comment_error.rb
reek-5.4.1 lib/reek/errors/bad_detector_in_comment_error.rb
reek-5.4.0 lib/reek/errors/bad_detector_in_comment_error.rb
reek-5.3.2 lib/reek/errors/bad_detector_in_comment_error.rb
reek-5.3.1 lib/reek/errors/bad_detector_in_comment_error.rb
reek-5.3.0 lib/reek/errors/bad_detector_in_comment_error.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/errors/bad_detector_in_comment_error.rb