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/SymbolProc false positive with unused argument #9257

Closed
vlad-pisanov opened this issue Dec 19, 2020 · 2 comments · Fixed by #9259
Closed

Style/SymbolProc false positive with unused argument #9257

vlad-pisanov opened this issue Dec 19, 2020 · 2 comments · Fixed by #9259
Labels

Comments

@vlad-pisanov
Copy link

Consider:

cat = Cat.new
[1, 2, 3].map { |_i| cat.meow }

Expected behavior

Should not register any offenses.

Actual behavior

Rubocop registers Style/SymbolProc offense: [Correctable] Style/SymbolProc: Pass &:meow as an argument to map instead of a block.

With the -A option, it autocorrects to:

cat = Cat.new
[1, 2, 3].map(&:meow)

RuboCop version

NOTE: this appears to be a regression because version 1.4.2 doesn't exhibit this behavior. Likely related to: #9232

1.6.1 (using Parser 2.7.2.0, rubocop-ast 1.3.0, running on ruby 2.4.5 x86_64-darwin19)
  - rubocop-minitest 0.10.1
  - rubocop-performance 1.9.1
  - rubocop-rails 2.9.1
@marcandre
Copy link
Contributor

marcandre commented Dec 19, 2020

Thanks for the report.
I don't think this was caused by #9232, but maybe by #9127?
@dvandersluis would you like to check this out?

@marcandre marcandre added the bug label Dec 19, 2020
@dvandersluis
Copy link
Member

Sure thing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants