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
-
.detect_plugin_gem_names ⇒ Array<String>
Returns full gem names of detected RuboCop plugins.
-
.detect_plugin_names ⇒ Array<String>
Returns short names of detected RuboCop plugins (without “rubocop-” prefix).
Class Method Details
.detect_plugin_gem_names ⇒ Array<String>
Returns full gem names of detected RuboCop plugins.
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_names ⇒ Array<String>
Returns short names of detected RuboCop plugins (without “rubocop-” prefix).
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 |