Class: RuboCop::PreferItParameter::Plugin

Inherits:
LintRoller::Plugin
  • Object
show all
Defined in:
lib/rubocop/prefer_it_parameter/plugin.rb,
sig/rubocop/prefer_it_parameter/plugin.rbs

Instance Method Summary collapse

Instance Method Details

#aboutObject



12
13
14
15
16
17
18
19
20
# File 'lib/rubocop/prefer_it_parameter/plugin.rb', line 12

def about
  LintRoller::About.new(
    name: "rubocop-prefer_it_parameter",
    version: VERSION,
    homepage: "https://github.com/tk0miya/rubocop-prefer_it_parameter",
    description: "A RuboCop plugin that recommends using the `it` block parameter " \
                 "instead of named block arguments in single-line blocks."
  )
end

#rules(_context) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/rubocop/prefer_it_parameter/plugin.rb', line 28

def rules(_context)
  LintRoller::Rules.new(
    type: :path,
    config_format: :rubocop,
    # `__dir__` is `String?` in the RBS stubs, so `__FILE__` is used instead.
    value: Pathname.new(__FILE__).dirname.join("../../../config/default.yml").expand_path
  )
end

#supported?(context) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/rubocop/prefer_it_parameter/plugin.rb', line 23

def supported?(context)
  context.engine == :rubocop
end