Parent

Methods

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Lint::ElseLayout

This cop checks for odd else block layout - like having an expression on the same line as the else keyword, which is usually a mistake.

@example

if something
  ...
else do_this
  do_that
end

Public Instance Methods

on_if(node) click to toggle source
# File lib/rubocop/cop/lint/else_layout.rb, line 17
def on_if(node)
  # ignore ternary ops
  return if node.loc.respond_to?(:question)
  # ignore modifier ops & elsif nodes
  return unless node.loc.end

  check(node)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.