This cop checks for uses of `fail` and `raise`.
# File lib/rubocop/cop/style/signal_exception.rb, line 35 def autocorrect(node) @corrections << lambda do |corrector| name = case style when :semantic then command?(:raise, node) ? 'fail' : 'raise' when :only_raise then 'raise' when :only_fail then 'fail' end corrector.replace(node.loc.selector, name) end end
# File lib/rubocop/cop/style/signal_exception.rb, line 12 def on_rescue(node) return unless style == :semantic begin_node, *rescue_nodes, _else_node = *node check_for(:raise, begin_node) rescue_nodes.each do |rescue_node| check_for(:fail, rescue_node) allow(:raise, rescue_node) end end
Generated with the Darkfish Rdoc Generator 2.