Sha256: a06ba8c184833ea9011bebc06b5aaf2b933c2f1e77e12494406ec4b872ea6407
Contents?: true
Size: 847 Bytes
Versions: 5
Compression:
Stored size: 847 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 convention(node, :begin) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems