Skip to content

Performance/StringIdentifierArgument autocorrect broke rack-unreloader autoload method #346

@davekaro

Description

@davekaro

Expected behavior

Running rubocop with Performance/StringIdentifierArgument enabled on a file that uses https://github.com/jeremyevans/rack-unreloader should not autocorrect the parameters to Unreloader.autoload to symbols.

Actual behavior

The Performance/StringIdentifierArgument turns the string path argument to Unreloader.autoload to a symbol, which causes exception:

<internal:dir>:220:in `glob': no implicit conversion of Symbol into String (TypeError)
	from /Users/dave/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rack-unreloader-2.1.0/lib/rack/unreloader.rb:31:in `block in expand_paths'

Steps to reproduce the problem

I started with https://github.com/jeremyevans/roda-sequel-stack/, followed the README to setup my app:

git clone https://github.com/jeremyevans/roda-sequel-stack.git my_app
cd my_app
rake "setup[MyApp]"

Then I added the standard gem, which enables the Performance/StringIdentifierArgument cop, and noticed the incorrect autocorrect.

RuboCop version

$ bundle exec rubocop -V
1.44.1 (using Parser 3.2.1.1, rubocop-ast 1.27.0, running on ruby 3.2.1) [arm64-darwin22]

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