class RuboCop::Cop::Style::WhenThen

end
when 2 then ‘bar’
when 1 then ‘baz’
case foo
# good
end
when 2; ‘bar’
when 1; ‘baz’
case foo
# bad
@example
Checks for ‘when;` uses in `case` expressions.

def on_when(node)

def on_when(node)
  return if node.multiline? || node.then? || !node.body
  message = format(MSG, expression: node.conditions.map(&:source).join(', '))
  add_offense(node.loc.begin, message: message) do |corrector|
    corrector.replace(node.loc.begin, ' then')
  end
end