Skip to content

Performance/StringIdentifierArgument unsafe autocorrection #289

@juanibiapina

Description

@juanibiapina

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions