Sha256: fc981a92fc9257ad8953d40c0de7da8f86d1b8f5b3751f53c7607c760d81c959
Contents?: true
Size: 553 Bytes
Versions: 2
Compression:
Stored size: 553 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) if node.loc.begin && node.loc.begin.is?(';') add_offense(node, :begin) end end def autocorrect(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.19.1 | lib/rubocop/cop/style/when_then.rb |
rubocop-0.19.0 | lib/rubocop/cop/style/when_then.rb |