Class: RuboCop::FactoryBot::DescriptionExtractor::CodeObject

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/factory_bot/description_extractor.rb

Overview

Decorator of a YARD code object for working with documented cops

Constant Summary collapse

RUBOCOP_COP_CLASS_NAME =
'RuboCop::Cop::Base'

Instance Method Summary collapse

Constructor Details

#initialize(yardoc) ⇒ CodeObject

Returns a new instance of CodeObject.



26
27
28
# File 'lib/rubocop/factory_bot/description_extractor.rb', line 26

def initialize(yardoc)
  @yardoc = yardoc
end

Instance Method Details

#configurationHash

Configuration for the documented cop that would live in default.yml

Returns:

  • (Hash)


40
41
42
# File 'lib/rubocop/factory_bot/description_extractor.rb', line 40

def configuration
  { cop_name => { 'Description' => description } }
end

#cop?Boolean

Test if the YARD code object documents a concrete cop class

Returns:

  • (Boolean)


33
34
35
# File 'lib/rubocop/factory_bot/description_extractor.rb', line 33

def cop?
  cop_subclass? && !abstract?
end