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

Performance/Sample cop incorrectly autocorrects #shuffle[0, 3] #1792

Closed
tindron opened this issue Apr 13, 2015 · 4 comments · Fixed by #1805
Closed

Performance/Sample cop incorrectly autocorrects #shuffle[0, 3] #1792

tindron opened this issue Apr 13, 2015 · 4 comments · Fixed by #1805

Comments

@tindron
Copy link

tindron commented Apr 13, 2015

#shuffle[0, 3] is autocorrected to #sample instead of #sample(3).

@bbatsov
Copy link
Collaborator

bbatsov commented Apr 16, 2015

//cc @rrosenblum

@rrosenblum
Copy link
Contributor

Sorry about that. I didn't realize that shuffle could take in multiple arguments. I don't think this will be difficult to fix.

@rrosenblum
Copy link
Contributor

...On closer look, that isn't multiple arguments, it is an array selector on the end of shuffle. This can still be accounted for.

@rrosenblum
Copy link
Contributor

I have found a fix for #shuffle[0, 3]. I have been stuck on trying to fix shuffle(random: Random.new(1)). My big pain right now is that issue with random is causing me to have to rewrite the entire cop. Parsing of the node for #shuffle[0, 3] produces completely different results than #shuffle(random: Random.new(1)).

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 a pull request may close this issue.

3 participants