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

Style/MutableConstant should be aware of # shareable_constant_value (Ruby 3.0) #9328

Closed
marcandre opened this issue Jan 3, 2021 · 3 comments · Fixed by #9929
Closed

Style/MutableConstant should be aware of # shareable_constant_value (Ruby 3.0) #9328

marcandre opened this issue Jan 3, 2021 · 3 comments · Fixed by #9929
Labels
bug good first issue Easy task, suitable for newcomers to the project help wanted

Comments

@marcandre
Copy link
Contributor

marcandre commented Jan 3, 2021

The following should not generate an offense:

# shareable_constant_value: literal (or experimental_everything)

MY_CONSTANT = %w[anything here is fine even non-literals]
@marcandre marcandre added bug good first issue Easy task, suitable for newcomers to the project help wanted labels Jan 3, 2021
@rrosenblum
Copy link
Contributor

rrosenblum commented Jan 6, 2021

Here's a link to some documentation on the feature, https://docs.ruby-lang.org/en/3.0.0/doc/syntax/comments_rdoc.html#label-shareable_constant_value+Directive.

https://bugs.ruby-lang.org/issues/17273

I hadn't heard of this being added before so I found it to be an interesting feature. It seems like the intent is to be used with Ractors

@marcandre
Copy link
Contributor Author

It seems like the intent is to be used with Ractors

That's one way to view it. The other way is the general position that constants should be immutable, and clearly when we say that we never mean actual classes. So in effect that is pretty much what "Ractor-shareable" means.

@caalberts
Copy link
Contributor

caalberts commented Jan 23, 2021

I created #9410 to recognize shareable_constant_value in Style/MutableConstant

caalberts added a commit to caalberts/rubocop that referenced this issue Feb 19, 2021
thearjunmdas added a commit to thearjunmdas/rubocop that referenced this issue Jul 13, 2021
thearjunmdas added a commit to thearjunmdas/rubocop that referenced this issue Jul 14, 2021
thearjunmdas added a commit to thearjunmdas/rubocop that referenced this issue Jul 14, 2021
thearjunmdas added a commit to thearjunmdas/rubocop that referenced this issue Jul 14, 2021
thearjunmdas added a commit to thearjunmdas/rubocop that referenced this issue Jul 21, 2021
thearjunmdas added a commit to thearjunmdas/rubocop that referenced this issue Aug 20, 2021
[Fix rubocop#9328] Resolve review comments

[Fix rubocop#9328] Removing nil check, refactoring spec

[Fix rubocop#9328] Tests for code next to inline comments

[Fix rubocop#9328] Move module to mutable_constant
thearjunmdas added a commit to thearjunmdas/rubocop that referenced this issue Aug 21, 2021
[Fix rubocop#9328] Resolve review comments

[Fix rubocop#9328] Removing nil check, refactoring spec

[Fix rubocop#9328] Tests for code next to inline comments

[Fix rubocop#9328] Move module to mutable_constant
thearjunmdas added a commit to thearjunmdas/rubocop that referenced this issue Aug 22, 2021
thearjunmdas added a commit to thearjunmdas/rubocop that referenced this issue Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Easy task, suitable for newcomers to the project help wanted
Projects
None yet
3 participants