Class: RuboCop::Sevgi::Plugin

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

Overview

Connects Sevgi's .sevgi rules to RuboCop's plugin system.

Instance Method Summary collapse

Instance Method Details

#aboutLintRoller::About

Describes this plugin to lint_roller.

Returns:

  • (LintRoller::About)

    plugin metadata



15
16
17
18
19
20
21
22
# File 'lib/rubocop/sevgi/plugin.rb', line 15

def about
  LintRoller::About.new(
    name: "sevgi-appendix",
    version: ::Sevgi::Appendix::VERSION,
    homepage: "https://sevgi.roktas.dev",
    description: "RuboCop rules for the Sevgi SVG DSL"
  )
end

#rules(_context) ⇒ LintRoller::Rules

Returns the RuboCop configuration bundled with this gem.

Parameters:

  • _context (LintRoller::Context)

    lint engine context

Returns:

  • (LintRoller::Rules)

    path-backed RuboCop rules



32
33
34
35
36
37
38
# File 'lib/rubocop/sevgi/plugin.rb', line 32

def rules(_context)
  LintRoller::Rules.new(
    type: :path,
    config_format: :rubocop,
    value: File.expand_path("../../../rubocop/config/default.yml", __dir__)
  )
end

#supported?(context) ⇒ Boolean

Reports whether this plugin supports the requested lint engine.

Parameters:

  • context (LintRoller::Context)

    lint engine context

Returns:

  • (Boolean)

    true for RuboCop



27
# File 'lib/rubocop/sevgi/plugin.rb', line 27

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