Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style/RedundantInterpolation: auto-correction adds unnecessary parentheses for single method call #8835

Closed
deepj opened this issue Oct 2, 2020 · 0 comments · Fixed by #8837
Labels

Comments

@deepj
Copy link
Contributor

deepj commented Oct 2, 2020

Expected behavior

Auto-corrected "#{number}" => number.to_s

Actual behavior

Auto-corrected "#{number}" => (number).to_s

Auto-corrected code violates Style/RedundantParentheses cop.

Steps to reproduce the problem

      if name.present?
        "#{number} [#{name}]"
      else
        "#{number}"
      end

Run

rubocop --only Style/RedundantInterpolation -a

RuboCop version

$ rubocop -V
0.92.0 (using Parser 2.7.1.5, rubocop-ast 0.7.1, running on ruby 2.7.1 x86_64-darwin18)
@koic koic added the bug label Oct 2, 2020
koic added a commit to koic/rubocop that referenced this issue Oct 5, 2020
…nterpolation`

Fixes rubocop#8835.

This PR fixes an incorrect autocorrect for `Style/RedundantInterpolation`
when using string interpolation for non-operator methods.
@koic koic closed this as completed in #8837 Oct 5, 2020
koic added a commit that referenced this issue Oct 5, 2020
…ndant_interpolation

[Fix #8835] Fix an incorrect autocorrect for `Style/RedundantInterpolation`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants