Sha256: 86f301d432fe026fe299ec4ba64ddc85526795f61469d554ef3d80e10fd1f025
Contents?: true
Size: 852 Bytes
Versions: 1
Compression:
Stored size: 852 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Style # This cop checks for redundant `begin` blocks. # # Currently it checks for code like this: # # @example # # def test # begin # ala # bala # rescue StandardError => e # something # end # end class RedundantBegin < Cop MSG = 'Redundant `begin` block detected.' def on_def(node) _method_name, _args, body = *node check(body) end def on_defs(node) _scope, _method_name, _args, body = *node check(body) end private def check(node) return unless node && node.type == :kwbegin add_offence(:convention, node.loc.begin, MSG) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.10.0 | lib/rubocop/cop/style/redundant_begin.rb |