Skip to content

Commit

Permalink
Update comment on resbody branches with nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
javierjulio committed Nov 22, 2024
1 parent ac74f66 commit dcdb8b1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/rubocop/cop/jackpocket/sneakers_job_control_signal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ def in_sneakers_worker?(node)
node.each_ancestor(:class, :block).detect { |anc| sneakers_worker?(anc) }
end

# We want the node and body in case the body is nil so on adding
# an offense we can still provide a node as the location.
# We want the node and body in case the body is empty. For example,
# this method body would be `nil`. Same for an empty rescue body.
#
# def work(message)
# end
#
# So then on adding an offense we can provide a node in place of
# the body as the location when the body is empty.
def resbody_branches_with_node(rescue_body)
items = rescue_body.resbody_branches.map do |b|
{ node: b, body: b.body }
Expand Down

0 comments on commit dcdb8b1

Please sign in to comment.