Rubocop: Prefer `block_given?` to `iterator?`

Created on 19 Jan 2019  路  3Comments  路  Source: rubocop-hq/rubocop

Is your feature request related to a problem? Please describe.

The iterator? form is mildly deprecated.

Describe the solution you'd like

Recommend to use block_given? instead of iterator?.

Additional context

feature request

Most helpful comment

Oh, wow. That is some old stuff. Had never heard about this alias before. 馃檪

All 3 comments

Oh, wow. That is some old stuff. Had never heard about this alias before. 馃檪

I assume this would go in a new Lint/BlockGiven cop. Or is there a better place in existing cops? @Drenmi

I think we can create the new Lint/KernelIteratorPredicate cop, which will be the deprecated method name.

Was this page helpful?
0 / 5 - 0 ratings