rubocop / rubocop-performance

An extension of RuboCop focused on code performance checks.
https://docs.rubocop.org/rubocop-performance
MIT License
674 stars 79 forks source link

Performance/StringIdentifierArgument unsafe autocorrection #289

Closed juanibiapina closed 2 years ago

juanibiapina commented 2 years ago

This cop autocorrects this:

Object.const_defined?('Rails::Console')

into

Object.const_defined?(:'Rails::Console')

Which then explodes with:

NameError (wrong constant name Rails::Console)

RuboCop version

$ [bundle exec] rubocop -V
1.26.0 (using Parser 3.1.2.0, rubocop-ast 1.18.0, running on ruby 2.7.6 x86_64-linux)
  - rubocop-performance 1.13.3
juanibiapina commented 2 years ago

@koic awesome!

koic commented 2 years ago

@juanibiapina Yeah, RuboCop Performance 1.14 has been released. Thank you for your feedback!