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

Add Node#any_block_type? to determine if a node is either a block or numblock #356

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

Earlopain
Copy link
Contributor

There are many instances where you just want to know if it's a block and don't care about what type it is: https://github.com/search?q=org%3Arubocop+%2Fblock.*numblock%2F&type=code

Should itblock be added, most of these will need to add yet another block type. With this, they can instead use this.

I had a bit of trouble choosing a good name. Maybe you have a better one to use?

@koic
Copy link
Member

koic commented Jan 22, 2025

This was originally envisioned as gen_block, but I think any_block is a sufficiently understandable naming choice. #205 (comment)

Especially, node.any_block_type? is likely easy to read and understand 👍

@marcandre
Copy link
Contributor

I was also going to say any_block 👍

@marcandre marcandre merged commit 5763d46 into rubocop:master Jan 27, 2025
22 checks passed
@marcandre
Copy link
Contributor

Thanks! ❤️

koic added a commit to rubocop/rubocop that referenced this pull request Jan 27, 2025
koic added a commit to rubocop/rubocop-performance that referenced this pull request Jan 27, 2025
koic added a commit to rubocop/rubocop-rails that referenced this pull request Jan 27, 2025
koic added a commit to rubocop/rubocop-minitest that referenced this pull request Jan 27, 2025
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.

3 participants