Exception: RuboCop::Plugin::NotSupportedError Private

Inherits:
Error
  • Object
show all
Defined in:
lib/rubocop/plugin/not_supported_error.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

An exception raised when a plugin is not supported by the RuboCop engine.

Instance Method Summary collapse

Constructor Details

#initialize(unsupported_plugins) ⇒ NotSupportedError

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of NotSupportedError.


8
9
10
11
12
# File 'lib/rubocop/plugin/not_supported_error.rb', line 8

def initialize(unsupported_plugins)
  super

  @unsupported_plugins = unsupported_plugins
end

Instance Method Details

#messageObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rubocop/plugin/not_supported_error.rb', line 14

def message
  if @unsupported_plugins.one?
    about = @unsupported_plugins.first.about

    "#{about.name} #{about.version} is not a plugin supported by RuboCop engine."
  else
    unsupported_plugin_names = @unsupported_plugins.map do |plugin|
      "#{plugin.about.name} #{plugin.about.version}"
    end.join(', ')

    "#{unsupported_plugin_names} are not plugins supported by RuboCop engine."
  end
end