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

RedundantBlockCall ignores class methods #261

Closed
vlad-pisanov opened this issue Oct 9, 2021 · 0 comments · Fixed by #266
Closed

RedundantBlockCall ignores class methods #261

vlad-pisanov opened this issue Oct 9, 2021 · 0 comments · Fixed by #266

Comments

@vlad-pisanov
Copy link
Contributor

Consider:

class C
  def self.foo(&block)
    block.call
  end

  def bar(&block)
    block.call
  end
end

Rubocop flags bar as a RedundantBlockCall offense, but not foo.


Expected behavior

Both foo and bar should be flagged as RedundantBlockCall

RuboCop version

1.22.1 (using Parser 3.0.2.0, rubocop-ast 1.12.0, running on ruby 2.6.6 x86_64-darwin20)
  - rubocop-performance 1.11.5
koic added a commit to koic/rubocop-performance that referenced this issue Oct 22, 2021
…kCall`

Fixes rubocop#261.

This PR fixes a false negative for `Performance/RedundantBlockCall`
when using `block.call` in a class method'.
@koic koic closed this as completed in #266 Oct 23, 2021
koic added a commit that referenced this issue Oct 23, 2021
…ndant_block_call

[Fix #261] Fix a false negative for `Performance/RedundantBlockCall`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant