Module: RuboCop::Cop::FactoryBot::ConfigurableExplicitOnly

Includes:
FactoryBot::Language
Included in:
ConsistentParenthesesStyle, CreateList, ExcessiveCreateList, FactoryNameStyle
Defined in:
lib/rubocop/cop/factory_bot/mixin/configurable_explicit_only.rb

Overview

Handles ‘ExplicitOnly` configuration parameters.

Constant Summary

Constants included from FactoryBot::Language

FactoryBot::Language::METHODS

Instance Method Summary collapse

Methods included from FactoryBot::Language

#factory_bot?

Instance Method Details

#explicit_only?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/rubocop/cop/factory_bot/mixin/configurable_explicit_only.rb', line 16

def explicit_only?
  cop_config['ExplicitOnly']
end

#factory_call?(node) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/rubocop/cop/factory_bot/mixin/configurable_explicit_only.rb', line 10

def factory_call?(node)
  return factory_bot?(node) if explicit_only?

  factory_bot?(node) || node.nil?
end