class RuboCop::Cop::Naming::VariableNumber

This cop makes sure that all numbered variables use the configured style, snake_case, normalcase, or non_integer, for their numbering.

@example EnforcedStyle: snake_case

# bad

variable1 = 1

# good

variable_1 = 1

@example EnforcedStyle: normalcase (default)

# bad

variable_1 = 1

# good

variable1 = 1

@example EnforcedStyle: non_integer

# bad

variable1 = 1

variable_1 = 1

# good

variableone = 1

variable_one = 1

Constants

MSG

Public Instance Methods

on_arg(node) click to toggle source
# File lib/rubocop/cop/naming/variable_number.rb, line 45
def on_arg(node)
  name, = *node
  check_name(node, name, node.loc.name)
end
Also aliased as: on_lvasgn, on_ivasgn, on_cvasgn
on_cvasgn(node)
Alias for: on_arg
on_ivasgn(node)
Alias for: on_arg
on_lvasgn(node)
Alias for: on_arg

Private Instance Methods

message(style) click to toggle source
# File lib/rubocop/cop/naming/variable_number.rb, line 55
def message(style)
  format(MSG, style: style)
end