Sha256: 79a21a39f5a722ece16e21eccfb6c2fd08b7e78d7d6fb4c33b70c91ee3ca2164
Contents?: true
Size: 751 Bytes
Versions: 3
Compression:
Stored size: 751 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Style # This cop checks for RuntimeError as the argument of raise/fail. # # Currently it checks for code like this: # # @example # # raise RuntimeError, 'message' class RedundantException < Cop MSG = 'Redundant `RuntimeError` argument can be removed.' TARGET_NODE = s(:const, nil, :RuntimeError) def on_send(node) return unless command?(:raise, node) || command?(:fail, node) _receiver, _selector, *args = *node return unless args.size == 2 first_arg, = *args convention(first_arg, :expression) if first_arg == TARGET_NODE end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.15.0 | lib/rubocop/cop/style/redundant_exception.rb |
rubocop-0.14.1 | lib/rubocop/cop/style/redundant_exception.rb |
rubocop-0.14.0 | lib/rubocop/cop/style/redundant_exception.rb |