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

Default style guide: "prefer find over detect" #247

Closed
jferris opened this issue Apr 30, 2014 · 3 comments · Fixed by #249
Closed

Default style guide: "prefer find over detect" #247

jferris opened this issue Apr 30, 2014 · 3 comments · Fixed by #249

Comments

@jferris
Copy link
Contributor

jferris commented Apr 30, 2014

In our style guide:

Prefer detect over find.

But hound is commenting with:

Prefer find over detect.

@salbertson
Copy link
Member

Thanks Joe.

@jaredbeck
Copy link

Just FYI: bbatsov's "community-driven style guide" says the opposite, and provides some rationale.

Prefer map over collect, find over detect, select over find_all, reduce over inject and size over length. This is not a hard requirement; if the use of the alias enhances readability, it's ok to use it. The rhyming methods are inherited from Smalltalk and are not common in other programming languages. The reason the use of select is encouraged over find_all is that it goes together nicely with reject and its name is pretty self-explanatory.

@schof
Copy link

schof commented May 3, 2015

For those of you wanting to ignore this rule you can add the following to your .rubcop.yml:

CollectionMethods:
  Enabled: false

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.

4 participants