Sha256: f17a1a3bb9e56fb9af05074ed353148e9a3b945a212bdf0bd54bb5a00e7b2f2d
Contents?: true
Size: 549 Bytes
Versions: 9
Compression:
Stored size: 549 Bytes
Contents
# encoding: utf-8 module RuboCop module Cop module Style # This cop checks for *when;* uses in *case* expressions. class WhenThen < Cop MSG = 'Never use `when x;`. Use `when x then` instead.' def on_when(node) return unless node.loc.begin && node.loc.begin.is?(';') add_offense(node, :begin) end def autocorrect(node) @corrections << lambda do |corrector| corrector.replace(node.loc.begin, ' then') end end end end end end
Version data entries
9 entries across 9 versions & 2 rubygems