Sha256: 453d31280fdae6a1b6d5b5f646c2d4b4412928b267e12476fe1afb6cfd00f6ec
Contents?: true
Size: 553 Bytes
Versions: 4
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_offence(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
4 entries across 4 versions & 1 rubygems