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

Disable Performance/RedundantBlockCall cop #45

Closed
wants to merge 1 commit into from

Conversation

onk
Copy link
Owner

@onk onk commented Dec 21, 2017

Both these patterns are reasonable.

# block arg and block call
def foo(&b)
  b.call
end

# no arg and yield
def foo
  yield
end

But this pattern is strange.

# block arg and discard block and yield
def foo(&b)
  yield
end

Binding block into Proc object (block arg make a Proc) means portability.
It should not be a argument when do not change or pass it.

Both this pattern are reasonable.

```
# block arg and block call
def foo(&b)
  b.call
end

# no arg and yield
def foo
  yield
end
```

But this pattern is strange.

```
# block arg and discard block and yield
def foo(&b)
  yield
end
```

Binding block into Proc object (block arg make a Proc) means portability.
It should not be a argument when do not change or pass it.
@onk onk closed this Jan 25, 2021
@onk onk deleted the disable_performance_redundant_block_call branch January 25, 2021 17:43
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 this pull request may close these issues.

1 participant