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

[Fix #10263] Fix aliasing problem for Enabled in Config #10797

Merged
merged 1 commit into from Jul 8, 2022

Conversation

jonas054
Copy link
Collaborator

@jonas054 jonas054 commented Jul 8, 2022

There was an aliasing problem in the Config class causing the cop_options local variable to reference the same object between different calls to for_cop even when the calls were to different Config objects with different @hash objects.

I have not been able to figure out the root cause. Only that the phenomenon occurs, and that duplicating the cop options before setting the Enabled property resolves it.

lib/rubocop/config.rb Outdated Show resolved Hide resolved
@jonas054
Copy link
Collaborator Author

jonas054 commented Jul 8, 2022

Thanks, @koic! Updated.

@koic
Copy link
Member

koic commented Jul 8, 2022

@jonas054 This looks good to me! Can you quash your commits into one?

There was an aliasing problem in the `Config` class causing the
`cop_options` local variable to reference the same object between
different calls to `for_cop` even when the calls were to different
`Config` objects with different `@hash` objects.

I have not been able to figure out the root cause. Only that the
phenomenon occurs, and that duplicating the cop options before
setting the `Enabled` property resolves it.
@jonas054
Copy link
Collaborator Author

jonas054 commented Jul 8, 2022

@koic It's a single commit now.

@koic koic merged commit 795739f into rubocop:master Jul 8, 2022
@koic
Copy link
Member

koic commented Jul 8, 2022

Thanks!

@jonas054 jonas054 deleted the 10263_fix_config_leaking branch July 9, 2022 08:26
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

2 participants