Sha256: 218b2debae352430e5735b1f5645dfbfb10687a67c35371022416d56c2ba6eac
Contents?: true
Size: 533 Bytes
Versions: 2
Compression:
Stored size: 533 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) convention(node, :begin) if node.loc.begin && node.loc.begin.is?(';') end def autocorrect_action(node) @corrections << lambda do |corrector| corrector.replace(node.loc.begin, ' then') end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.13.1 | lib/rubocop/cop/style/when_then.rb |
rubocop-0.13.0 | lib/rubocop/cop/style/when_then.rb |