Class: RuboCop::SortedMethodsByCall::Plugin
- Inherits:
-
LintRoller::Plugin
- Object
- LintRoller::Plugin
- RuboCop::SortedMethodsByCall::Plugin
- Defined in:
- lib/rubocop/sorted_methods_by_call/plugin.rb
Overview
RuboCop::SortedMethodsByCall::Plugin integrates this extension with RuboCop’s plugin system via lint_roller. It declares metadata and tells RuboCop where to find the plugin’s default configuration.
The plugin is discovered by RuboCop when you configure:
plugins:
- rubocop-sorted_methods_by_call
It will automatically apply rules (config/default.yml) and make the cops available to the engine.
Instance Method Summary collapse
-
#about ⇒ LintRoller::About
RuboCop::SortedMethodsByCall::Plugin#about -> LintRoller::About.
-
#rules(_context) ⇒ LintRoller::Rules
RuboCop::SortedMethodsByCall::Plugin#rules -> LintRoller::Rules.
-
#supported?(context) ⇒ Boolean
RuboCop::SortedMethodsByCall::Plugin#supported? -> Boolean.
Instance Method Details
#about ⇒ LintRoller::About
RuboCop::SortedMethodsByCall::Plugin#about -> LintRoller::About
Declares plugin metadata (name, version, homepage, description).
24 25 26 27 28 29 30 31 |
# File 'lib/rubocop/sorted_methods_by_call/plugin.rb', line 24 def about LintRoller::About.new( name: 'rubocop-sorted_methods_by_call', version: VERSION, homepage: 'https://github.com/unurgunite/rubocop-sorted_methods_by_call', description: 'Enforces waterfall ordering: define methods after the methods that call them.' ) end |
#rules(_context) ⇒ LintRoller::Rules
RuboCop::SortedMethodsByCall::Plugin#rules -> LintRoller::Rules
Returns the plugin rules for RuboCop. This points RuboCop to the default configuration file shipped with the gem (config/default.yml).
52 53 54 55 56 57 58 |
# File 'lib/rubocop/sorted_methods_by_call/plugin.rb', line 52 def rules(_context) LintRoller::Rules.new( type: :path, config_format: :rubocop, value: Pathname.new(__dir__).join('../../../config/default.yml') ) end |
#supported?(context) ⇒ Boolean
RuboCop::SortedMethodsByCall::Plugin#supported? -> Boolean
Indicates that this plugin supports RuboCop as the lint engine.
39 40 41 |
# File 'lib/rubocop/sorted_methods_by_call/plugin.rb', line 39 def supported?(context) context.engine == :rubocop end |