Class: Roodi::Checks::EmptyRescueBodyCheck
- Defined in:
- lib/roodi/checks/empty_rescue_body_check.rb
Overview
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.
Constant Summary collapse
- STATEMENT_NODES =
[:fcall, :return, :attrasgn, :vcall, :nil, :call, :lasgn, :true, :false]
Constants inherited from Check
Instance Method Summary collapse
Methods inherited from Check
#add_error, #end_file, #errors, #evaluate_end, #evaluate_node, #evaluate_node_end, #evaluate_node_start, #initialize, make, #position, #start_file
Constructor Details
This class inherits a constructor from Roodi::Checks::Check
Instance Method Details
#evaluate_start(node) ⇒ Object
16 17 18 |
# 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 |
#interesting_nodes ⇒ Object
12 13 14 |
# File 'lib/roodi/checks/empty_rescue_body_check.rb', line 12 def interesting_nodes [:resbody] end |