Class Roodi::Checks::EmptyRescueBodyCheck
In: lib/roodi/checks/empty_rescue_body_check.rb
Parent: Roodi::Checks::Check

Checks the body of a rescue block to make sure it‘s not empty..

When the body of a rescue block is empty, exceptions can get caught and swallowed without any feedback to the user.

Methods

Constants

STATEMENT_NODES = [:fcall, :return, :attrasgn, :vcall, :nil, :call, :lasgn]

Public Instance methods

[Source]

# File lib/roodi/checks/empty_rescue_body_check.rb, line 16
      def evaluate_start(node)
        add_error("Rescue block should not be empty.") unless has_statement?(node.children[1])
      end

[Source]

# File lib/roodi/checks/empty_rescue_body_check.rb, line 12
      def interesting_nodes
        [:resbody]
      end

[Validate]