Skip to content

Commit

Permalink
Ask if node is assignment, instead of creating new list
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc committed Jan 18, 2019
1 parent 5371b80 commit f79c30f
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions lib/rubocop/cop/layout/rescue_ensure_alignment.rb
Expand Up @@ -30,17 +30,6 @@ class RescueEnsureAlignment < Cop
ANCESTOR_TYPES = %i[kwbegin def defs class module].freeze
RUBY_2_5_ANCESTOR_TYPES = (ANCESTOR_TYPES + %i[block]).freeze
ANCESTOR_TYPES_WITH_ACCESS_MODIFIERS = %i[def defs].freeze
ASSIGNMENT_TYPES = %i[
lvasgn
ivasgn
cvasgn
gvasgn
casgn
masgn
op_asgn
and_asgn
or_asgn
].freeze

def on_resbody(node)
check(node) unless modifier?(node)
Expand Down Expand Up @@ -151,8 +140,7 @@ def ancestor_node(node)
def assignment_node(node)
assignment_node = node.ancestors.first
return nil unless
assignment_node &&
ASSIGNMENT_TYPES.include?(assignment_node.type)
assignment_node && assignment_node.assignment?

assignment_node
end
Expand Down

0 comments on commit f79c30f

Please sign in to comment.