Class: RuboCop::OneoffCodemod::Plugin

Inherits:
LintRoller::Plugin
  • Object
show all
Defined in:
lib/rubocop/oneoff_codemod/plugin.rb

Overview

A plugin that integrates RuboCop Oneoff Codemod with RuboCop’s plugin system.

Instance Method Summary collapse

Instance Method Details

#aboutObject



9
10
11
12
13
14
15
16
17
# File 'lib/rubocop/oneoff_codemod/plugin.rb', line 9

def about
  LintRoller::About.new(
    name: "rubocop-oneoff_codemod",
    version: RuboCop::OneoffCodemod::VERSION,
    homepage: "https://github.com/kozy4324/rubocop-oneoff_codemod",
    description: "A RuboCop plugin implementing comment-as-command for one-off codemod, inspired " \
                 "by eslint-plugin-command."
  )
end

#rules(_context) ⇒ Object



23
24
25
26
27
# File 'lib/rubocop/oneoff_codemod/plugin.rb', line 23

def rules(_context)
  project_root = Pathname.new(__dir__).join("../../../") # steep:ignore

  LintRoller::Rules.new(type: :path, config_format: :rubocop, value: project_root.join("config", "default.yml"))
end

#supported?(context) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/rubocop/oneoff_codemod/plugin.rb', line 19

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