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

False negative with Lint/SymbolConversion in combination with string interpolation #12373

Closed
Earlopain opened this issue Nov 8, 2023 · 0 comments

Comments

@Earlopain
Copy link
Contributor

Earlopain commented Nov 8, 2023

With code like this I expect Lint/SymbolConversion to trigger an offence. Interpolation isn't currently considered.

foo = "bar"
"#{foo}_baz".to_sym
=> :bar_baz

Autocorrect would be the following which is equivalent:

:"#{foo}_baz"

RuboCop version

1.55.1 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 3.2.2) [x86_64-linux-musl]
  - rubocop-erb 0.3.0
  - rubocop-rails 2.20.2
tagliala added a commit to tagliala/caxlsx that referenced this issue Nov 17, 2023
Compared to String#to_sym, symbol conversion is:

- 6 character shorter
- Highlighted as a symbol (at least by TextMate and VS Code)
- 7% faster

This offense is not being detected by Rubocop because caxlsx is using
an old version which works on 2.6 and the current version does not
detect this problem because of rubocop/rubocop#12373
tagliala added a commit to tagliala/caxlsx that referenced this issue Nov 17, 2023
Compared to String#to_sym, symbol conversion is:

- 6 character shorter
- Highlighted as a symbol (at least by TextMate and VS Code)
- 7% faster

This offense is not being detected by Rubocop because caxlsx is using
an old version which works on 2.6 and the current version does not
detect this problem because of rubocop/rubocop#12373
Sefux pushed a commit to 3plusx/caxlsx that referenced this issue Jan 3, 2024
Compared to String#to_sym, symbol conversion is:

- 6 character shorter
- Highlighted as a symbol (at least by TextMate and VS Code)
- 7% faster

This offense is not being detected by Rubocop because caxlsx is using
an old version which works on 2.6 and the current version does not
detect this problem because of rubocop/rubocop#12373
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants