-
Notifications
You must be signed in to change notification settings - Fork 281
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 Tempfile.create
to ignored iterators list
#1747
Add Tempfile.create
to ignored iterators list
#1747
Conversation
Looks good to me! @mvz ? |
I'll have a look this evening. |
The code looks good, but there are two issues:
|
Ah, that detector simply finds calls to |
"#{call.receiver&.name}.#{called_name}" | ||
else | ||
called_name | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following seems to work and won't trigger ManualDispatch:
/#{pattern}/ =~ call.format_to_ruby
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I never heard of that method. Will edit the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a method defined on AST nodes by Reek itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied changes
c1c7095
to
7dedfb3
Compare
@mvz As for this, now that I'm rereading it, I'm not sure. I interpreted it at the time as being "A PR that whitelists Tempfile.create". But if it's an option, than I suppose it would be something like a |
Yes, it would be the |
I see. In that case, I'm not sure, honestly. Now that I think about it, maybe I just leave the addition of the Because I still get the impression the idea was that Now I'm not so sure about the PR anymore lol |
I think the change to @troessner can you enlighten us about your comment #1490 (comment)? |
Puhh, that's 4 years ago and I haven't really any context anymore regarding this. Feel free to ignore my comment ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright then, let's merge this!
Fixes #1490
I've added
Tempfile.create
to the list of ignored iterators and added a spec for it.I'm submitting the PR to also get some feedback on the implementation. The specs all pass but it fails on the manual method dispatch code smell.
I tried searching for alternative ways to implement this without using
respond_to?
but didn't really find anything satisfactory, and if I don't test for that beforehand, many specs fail on exceptions because theexp
object lacks thereceiver
method. Feedback on how to fix this would be most welcome!Otherwise, I hope this is useful!