Class: RuboCop::Tablecop::Plugin

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

Overview

Integrates rubocop-tablecop with RuboCop’s plugin system.

This plugin provides cops for table-like, condensed Ruby formatting:

  • AlignAssignments: Align consecutive assignments on the = operator

  • AlignMethods: Align contiguous single-line method definitions

  • CondenseWhen: Condense multi-line when clauses to single lines

  • SafeEndlessMethod: Convert methods to endless form safely

Instance Method Summary collapse

Instance Method Details

#aboutObject



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

def about
  LintRoller::About.new(
    name: "rubocop-tablecop",
    version: Version::STRING,
    homepage: "https://github.com/v2-io/tablecop",
    description: "Table-like, condensed Ruby formatting cops."
  )
end

#rules(_context) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/rubocop/tablecop/plugin.rb', line 28

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

#supported?(context) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/rubocop/tablecop/plugin.rb', line 24

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