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 GitHub/AvoidObjectSendWithDynamicMethod cop #145

Merged
merged 6 commits into from
Jan 5, 2024

Conversation

cheshire137
Copy link
Member

@cheshire137 cheshire137 commented Jan 3, 2024

This adds a new cop to detect when use of Object#send, #public_send, or __send__. At first I had the Rubocop flagging every use of a send method, but I scaled that back so the cop is less strict. If the method name being sent is constant, like foo.send(:bar), the cop doesn't complain. The cop also allows for partially dynamic method names, as long as some of the method being sent is constant.

Related:

@cheshire137 cheshire137 self-assigned this Jan 3, 2024
@cheshire137 cheshire137 requested a review from a team as a code owner January 3, 2024 19:40
@cheshire137 cheshire137 merged commit 5431a42 into main Jan 5, 2024
8 checks passed
@cheshire137 cheshire137 deleted the cop-no-dyn-obj-send branch January 5, 2024 20:05
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.

2 participants