Module: RuboCop::Plugin Private

Defined in:
lib/rubocop/plugin.rb,
lib/rubocop/plugin/loader.rb,
lib/rubocop/plugin/load_error.rb,
lib/rubocop/plugin/not_supported_error.rb,
lib/rubocop/plugin/configuration_integrator.rb

Overview

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

Provides a plugin for RuboCop extensions that conform to lint_roller. github.com/standardrb/lint_roller

Defined Under Namespace

Classes: ConfigurationIntegrator, LoadError, Loader, NotSupportedError

Constant Summary collapse

BUILTIN_INTERNAL_PLUGINS =

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

{
  'rubocop-internal_affairs' => {
    'enabled' => true,
    'require_path' => 'rubocop/cop/internal_affairs/plugin',
    'plugin_class_name' => 'RuboCop::InternalAffairs::Plugin'
  }
}.freeze
INTERNAL_AFFAIRS_PLUGIN_NAME =

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

Plugin::BUILTIN_INTERNAL_PLUGINS.keys.first
OBSOLETE_INTERNAL_AFFAIRS_PLUGIN_NAME =

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

'rubocop/cop/internal_affairs'

Class Method Summary collapse

Class Method Details

.integrate_plugins(rubocop_config, plugins) ⇒ Object

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.



37
38
39
40
41
42
43
# File 'lib/rubocop/plugin.rb', line 37

def integrate_plugins(rubocop_config, plugins)
  plugins = Plugin::Loader.load(plugins)

  ConfigurationIntegrator.integrate_plugins_into_rubocop_config(rubocop_config, plugins)

  plugins
end

.plugin_capable?(feature_name) ⇒ Boolean

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:

  • (Boolean)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rubocop/plugin.rb', line 22

def plugin_capable?(feature_name)
  return true if BUILTIN_INTERNAL_PLUGINS.key?(feature_name)
  return true if feature_name == OBSOLETE_INTERNAL_AFFAIRS_PLUGIN_NAME

  begin
    # When not using Bundler. Makes the spec available but does not require it.
    gem feature_name
  rescue Gem::LoadError
    # The user requested a gem that they do not have installed
  end
  return false unless (spec = Gem.loaded_specs[feature_name])

  !!spec.['default_lint_roller_plugin']
end