class RuboCop::Cop::Lint::OrAssignmentToConstant


CONST = 1
# good
CONST ||= 1
# bad
@example
change the result.
Also, if you already have such an implementation, auto-correction may
locations, the result may vary depending on the order of ‘require`.
should always be the same. If constants are assigned in multiple
Constants should always be assigned in the same location. And its value
This cop checks for unintended or-assignment to a constant.

def on_or_asgn(node)

def on_or_asgn(node)
  lhs, _rhs = *node
  return unless lhs&.casgn_type?
  add_offense(node.loc.operator) do |corrector|
    corrector.replace(node.loc.operator, '=')
  end
end