Skip to content

Commit

Permalink
Remove const_get from StringIdentifierArgument target
Browse files Browse the repository at this point in the history
[Fix rubocop#425]
`const_get` doesn't accept symbols that are something like
`:"Foo::Bar"`, and that's intended according to this issue.
https://bugs.ruby-lang.org/issues/12319
Therefore, changing String to Symbol might not work as expected.
As far as I know that's related to `const_get` only so we can remove
it from the target of `StringIdentifierArgument`
  • Loading branch information
okuramasafumi committed Dec 21, 2023
1 parent a5d918a commit 93f2b25
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelog/fix_string_identifier_argument_with_const_get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* [#427](https://github.com/rubocop/rubocop-performance/issues/425): Remove `const_get` from `StringIdentifierArgument` target. ([@okuramasafumi][])

2 changes: 1 addition & 1 deletion lib/rubocop/cop/performance/string_identifier_argument.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class StringIdentifierArgument < Base
# And `attr` may not be used because `Style/Attr` registers an offense.
# https://github.com/rubocop/rubocop-performance/issues/278
RESTRICT_ON_SEND = (%i[
class_variable_defined? const_defined? const_get const_set const_source_location
class_variable_defined? const_defined? const_set const_source_location
define_method instance_method method_defined? private_class_method? private_method_defined?
protected_method_defined? public_class_method public_instance_method public_method_defined?
remove_class_variable remove_method undef_method class_variable_get class_variable_set
Expand Down

0 comments on commit 93f2b25

Please sign in to comment.