Class: RuboCop::Capybara::Plugin

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

Overview

A plugin that integrates RuboCop Capybara with RuboCop’s plugin system.

Instance Method Summary collapse

Instance Method Details

#aboutObject

:nocov:



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

def about
  LintRoller::About.new(
    name: 'rubocop-capybara',
    version: Version::STRING,
    homepage: 'https://github.com/rubocop/rubocop-capybara',
    description: 'Code style checking for Capybara test files.'
  )
end

#rules(_context) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rubocop/capybara/plugin.rb', line 24

def rules(_context)
  project_root = Pathname.new(__dir__).join('../../..')

  obsoletion = project_root.join('config', 'obsoletion.yml')
  ConfigObsoletion.files << obsoletion if obsoletion.exist?

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

#supported?(context) ⇒ Boolean

:nocov:

Returns:

  • (Boolean)


20
21
22
# File 'lib/rubocop/capybara/plugin.rb', line 20

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