Class: RuboCop::Cop::MagicNumbers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/cop/magic_numbers/base.rb

Overview

Base class for all shared behaviour between these cops

Direct Known Subclasses

NoArgument, NoAssignment, NoDefault, NoReturn

Constant Summary collapse

CONFIG_ALL =
'All'
CONFIG_FLOAT =
'Float'
CONFIG_INTEGER =
'Integer'
CONFIG_NAME_FORBIDDEN_NUMERICS =
'ForbiddenNumerics'
DEFAULT_CONFIG =
{
  CONFIG_NAME_FORBIDDEN_NUMERICS => CONFIG_ALL
}.freeze
ILLEGAL_SCALAR_TYPES =
{
  CONFIG_ALL => %i[float int],
  CONFIG_INTEGER => %i[int],
  CONFIG_FLOAT => %i[float]
}.freeze

Instance Method Summary collapse

Instance Method Details

#cop_configObject

The configuration for this cop, pre-set with defaults

Returns Hash



44
45
46
# File 'lib/rubocop/cop/magic_numbers/base.rb', line 44

def cop_config
  DEFAULT_CONFIG.merge(super)
end