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

Add entry for No Mutable Defaults #955

Merged

Conversation

corsonknowles
Copy link
Contributor

Avoid the use of shared mutable objects as hash default values.

Complements: rubocop/rubocop#13463

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Thank you!

Avoid the use of shared mutable objects as hash default values.

Complements: rubocop/rubocop#13463

Up
@corsonknowles corsonknowles force-pushed the add_entry_for_shared_mutable_defaults branch from 41fb457 to 3b7c969 Compare November 29, 2024 21:34
@pirj pirj requested a review from a team November 29, 2024 21:55
Hash.new(Array.new)
Hash.new(Hash.new)

# okay -- beware this will silently discard mutations and only remember assignments
Copy link
Contributor

@andyw8 andyw8 Nov 30, 2024

Choose a reason for hiding this comment

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

Are there any legitimate uses for this? Can we say 'probably bad' instead of 'okay'?

This can be discussed in rubocop/rubocop#13463 instead.

@bbatsov bbatsov merged commit dd6d129 into rubocop:master Dec 18, 2024
3 checks passed
koic added a commit to rubocop/rubocop that referenced this pull request Dec 19, 2024
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.

4 participants