Skip to content

Commit

Permalink
Don't mutate arguments.
Browse files Browse the repository at this point in the history
Too lazy to factorize this pattern
  • Loading branch information
marcandre authored and bbatsov committed Aug 5, 2020
1 parent bcfff57 commit bf47e35
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -37,7 +37,7 @@ def on_send(node)
# ...then each key/value pair is treated as a method 'argument'
# when determining where line breaks should appear.
if (last_arg = args.last)
args = args.concat(args.pop.children) if last_arg.hash_type? && !last_arg.braces?
args = args[0...-1] + last_arg.children if last_arg.hash_type? && !last_arg.braces?
end

check_line_breaks(node, args)
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/mixin/check_line_breakable.rb
Expand Up @@ -171,7 +171,7 @@ def process_args(args)
# ...then each key/value pair is treated as a method 'argument'
# when determining where line breaks should appear.
if (last_arg = args.last)
args = args.concat(args.pop.children) if last_arg.hash_type? && !last_arg.braces?
args = args[0...-1] + last_arg.children if last_arg.hash_type? && !last_arg.braces?
end
args
end
Expand Down

0 comments on commit bf47e35

Please sign in to comment.