Module: Docquet::PluginDetector

Defined in:
lib/docquet/plugin_detector.rb

Overview

Detects available RuboCop plugins and provides consistent naming.

Terminology:

  • Plugin Gem Name: Full gem name (e.g., “rubocop-performance”, “rubocop-rspec”)

  • Plugin Name: Short name without prefix (e.g., “performance”, “rspec”)

Both forms are used in different contexts:

  • Plugin Gem Names: For gem operations, –plugin CLI arguments

  • Plugin Names: For config file matching, department filtering

Class Method Summary collapse

Class Method Details

.detect_plugin_gem_namesArray<String>

Returns full gem names of detected RuboCop plugins.

Returns:

  • (Array<String>)

    plugin gem names (e.g., [“rubocop-performance”, “rubocop-rspec”])



17
18
19
20
# File 'lib/docquet/plugin_detector.rb', line 17

module_function def detect_plugin_gem_names
  plugins = Gem::Specification.select {|spec| /\ARuboCop::.*::Plugin\z/ =~ spec.["default_lint_roller_plugin"] }
  plugins.map(&:name)
end

.detect_plugin_namesArray<String>

Returns short names of detected RuboCop plugins (without “rubocop-” prefix).

Returns:

  • (Array<String>)

    plugin names (e.g., [“performance”, “rspec”])



25
26
27
# File 'lib/docquet/plugin_detector.rb', line 25

module_function def detect_plugin_names
  detect_plugin_gem_names.map {|name| name.delete_prefix("rubocop-") }
end