class RubbyCop::Cop::Lint::EmptyWhen
This cop checks for the presence of `when` branches without a body.
@example
# bad case foo when bar then 1 when baz then # nothing end
@example
# good case foo when bar then 1 when baz then 2 end
Constants
- MSG
Public Instance Methods
on_case(node)
click to toggle source
# File lib/rubbycop/cop/lint/empty_when.rb, line 28 def on_case(node) node.each_when do |when_node| next if when_node.body add_offense(when_node, when_node.source_range, MSG) end end