class RuboCop::Cop::Lint::EndAlignment

end
variable = if true
@example
left-hand-side of the variable assignment, if there is one.
it’s set to ‘variable` the `end` shall be aligned with the
shall be aligned with the start of the keyword (if, class, etc.). If
parameter. If it’s set to ‘keyword` (which is the default), the `end`
Two modes are supported through the AlignWith configuration
This cop checks whether the end keywords are aligned properly.

def check_assignment(node, rhs)

def check_assignment(node, rhs)
  # If there are method calls chained to the right hand side of the
  # assignment, we let rhs be the receiver of those method calls before
  # we check if it's an if/unless/while/until.
  rhs = first_part_of_call_chain(rhs)
  return unless rhs
  return unless [:if, :while, :until].include?(rhs.type)
  return if ternary_op?(rhs)
  if style == :variable
    expr = node.loc.expression
    range = Parser::Source::Range.new(expr.source_buffer,
                                      expr.begin_pos,
                                      rhs.loc.keyword.end_pos)
    offset = rhs.loc.keyword.column - node.loc.expression.column
  else
    range = rhs.loc.keyword
    offset = 0
  end
  check_offset(rhs, range.source, offset)
  ignore_node(rhs) # Don't check again.
end

def on_class(node)

def on_class(node)
  check_offset_of_node(node)
end

def on_if(node)

def on_if(node)
  check_offset_of_node(node) unless ternary_op?(node)
end

def on_module(node)

def on_module(node)
  check_offset_of_node(node)
end

def on_until(node)

def on_until(node)
  check_offset_of_node(node)
end

def on_while(node)

def on_while(node)
  check_offset_of_node(node)
end