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/ExplicitBlockArgument autocorrect doesn't take into if it's yielding the same args #9304

Closed
kitsunde opened this issue Dec 29, 2020 · 0 comments · Fixed by #9310
Closed
Labels

Comments

@kitsunde
Copy link

Given

def each
  each_row do |row, index|
    yield row
  end
end

Expected behaviour

rubocop -A should at worst do nothing.

Actual behavior

def each(&block)
  each_row(&block)
end

This now populates the 2nd argument of each, so it's not equivalent.

Steps to reproduce the problem

Run rubocop -A on:

def each_row
  9.times.each_with_index do |row, index|
    yield row, index
  end
end

def each
  each_row do |row, index|
    yield row
  end
end

RuboCop version

$ bundle exec rubocop -V
0.89.1 (using Parser 2.7.2.0, rubocop-ast 0.3.0, running on ruby 2.7.1 x86_64-darwin19)
@koic koic added the bug label Dec 29, 2020
dvandersluis added a commit to dvandersluis/rubocop that referenced this issue Jan 10, 2021
…kArgument` when the `yield` arguments are not an exact match with the block arguments.
bbatsov pushed a commit that referenced this issue Jan 11, 2021
…nt` when the `yield` arguments are not an exact match with the block arguments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants