Class: RuboCop::Style::CompactNesting::Plugin

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

Overview

A RuboCop plugin (LintRoller) that registers the ‘Style/CompactModuleNesting` cop and its default configuration.

Instance Method Summary collapse

Instance Method Details

#aboutObject



11
12
13
14
15
16
17
18
19
# File 'lib/rubocop/style/compact_nesting/plugin.rb', line 11

def about
  LintRoller::About.new(
    name: 'rubocop-style-compact_nesting',
    version: VERSION,
    homepage: 'https://github.com/ramongr/rubocop-style-compact_nesting',
    description: 'Enforce compact outer module nesting with a separately ' \
                 'nested innermost class/module.'
  )
end

#rules(_context) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/rubocop/style/compact_nesting/plugin.rb', line 25

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

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

#supported?(context) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/rubocop/style/compact_nesting/plugin.rb', line 21

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