Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register an offense for RedundantMerge inside each_with_object #2963

Merged
merged 1 commit into from Mar 22, 2016

Conversation

rrosenblum
Copy link
Contributor

Part of the benefit of each_with_object is using mutable objects. value_used? isn't actual accurate in this condition.

What do you think about accounting for this inside of value_used? instead of only in RedundantMerge?

@rrosenblum rrosenblum force-pushed the each_with_object_redundant_merge branch 2 times, most recently from 65bfe12 to b983998 Compare March 18, 2016 21:09
end

it 'autocorrects when the receiver is the object being built when ' \
'merge! is not the last statement' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But is is the last statement (of the block) here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, copy paste mistake.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the test has been updated.

@rrosenblum rrosenblum force-pushed the each_with_object_redundant_merge branch 2 times, most recently from fa35bd8 to cfba31c Compare March 20, 2016 19:41
next if node.value_used?
if node.value_used?
parent = node.parent
grand_parent = parent.parent if parent.begin_type?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't grandparent a single word in english?

@rrosenblum rrosenblum force-pushed the each_with_object_redundant_merge branch from cfba31c to 8337e5d Compare March 22, 2016 21:24
@rrosenblum rrosenblum force-pushed the each_with_object_redundant_merge branch from 8337e5d to 7d89757 Compare March 22, 2016 21:26
bbatsov added a commit that referenced this pull request Mar 22, 2016
…erge

Register an offense for RedundantMerge inside each_with_object
@bbatsov bbatsov merged commit c1ed9fe into rubocop:master Mar 22, 2016
@rrosenblum rrosenblum deleted the each_with_object_redundant_merge branch March 23, 2016 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants