You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following line is not correctly handled by the autocorrect behavior for Style/RedundantInterpolation
"#{my_methodarg}"
Running rubocop -a changes it to
my_methodarg.to_s
The correct replacement is
my_method(arg).to_s
Expected behavior
Either the autocorrect behavior for Style/RedundantInterpolation should be updated to handle method calls without parens, or the rule should be marked SafeAutocorrect: false
Actual behavior
Running rubocop -a on a file containing a redundant interpolation can result in an incorrect replacement as shown above.
Steps to reproduce the problem
Save a new file redundant_interpolation_test.rb containing the following:
…Interpolation`
Fixesrubocop#10276.
This PR fixes an incorrect autocorrect for `Style/RedundantInterpolation`
when using a method call without parentheses in string interpolation.
The following line is not correctly handled by the autocorrect behavior for
Style/RedundantInterpolation
"#{my_method arg}"
Running
rubocop -a
changes it toThe correct replacement is
Expected behavior
Either the autocorrect behavior for Style/RedundantInterpolation should be updated to handle method calls without parens, or the rule should be marked SafeAutocorrect: false
Actual behavior
Running
rubocop -a
on a file containing a redundant interpolation can result in an incorrect replacement as shown above.Steps to reproduce the problem
redundant_interpolation_test.rb
containing the following:"#{my_method arg}"
run
rubocop -a redundant_interpolation_test.rb
Observe that the file has been changed to
RuboCop version
The text was updated successfully, but these errors were encountered: