Class: RuboCop::Erb::Plugin

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

Overview

A plugin that integrates rubocop-erb with RuboCop’s plugin system.

Instance Method Summary collapse

Instance Method Details

#aboutObject



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

def about
  LintRoller::About.new(
    description: 'RuboCop plugin for ERB template.',
    homepage: 'https://github.com/r7kamura/rubocop-erb',
    name: 'rubocop-erb',
    version: VERSION
  )
end

#rules(_context) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/rubocop/erb/plugin.rb', line 18

def rules(_context)
  RuboCop::Runner.ruby_extractors.unshift(RuboCop::Erb::RubyExtractor)

  LintRoller::Rules.new(
    config_format: :rubocop,
    type: :path,
    value: Pathname.new(__dir__).join('../../../config/default.yml')
  )
end

#supported?(context) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/rubocop/erb/plugin.rb', line 28

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