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

has_key? description note is giving false impression #595

Merged
merged 1 commit into from
Dec 31, 2016

Conversation

mentero
Copy link
Contributor

@mentero mentero commented Aug 18, 2016

Hi

Currently in a section regarding has_key? vs key? there is a sentence linking to an old email which was used as a rationale for this rule. It is also noted that the has_key? is considered deprecated.

I believe that this note is unnecessary and can give a false impression. has_key? is not considered deprecated and is still actively in use. Matz clearly stated that it is not going anywhere here rubocop/rubocop#3224

This makes me believe that the note about has_key? deprecation in Matz's mail was simply an unfortunately phrased opinion on a personal preference and is not an official statement of a core team.

To back it up this rule started a discussion in my team today and this part of style guide was brought up as an argument while I firmly believe that choosing between has_key? and key? is highly subjective matter and one is arguably better than the other. This is especially true since the rationale behind this rule is no longer valid.


Looks like my editor also fixed some trailing whitespaces ;)

@mentero mentero changed the title has_key? description is giving false impression has_key? description note is giving false impression Aug 18, 2016
@booch
Copy link

booch commented Aug 24, 2016

If they're no longer (and maybe never have been) deprecated, it would seem that the longer versions should be preferred, as they're more clearly intention-revealing.

@bbatsov
Copy link
Collaborator

bbatsov commented Aug 24, 2016

If they're no longer (and maybe never have been) deprecated, it would seem that the longer versions should be preferred, as they're more clearly intention-revealing.

They are still inconsistent with most predicates in the core and standard library.

@bbatsov bbatsov merged commit 03f2627 into rubocop:master Dec 31, 2016
@mentero mentero deleted the feature/has_key_is_not_deprecated branch January 4, 2017 17:48
pocke pushed a commit to pocke/ruby-style-guide that referenced this pull request Feb 7, 2017
ellimist pushed a commit to ellimist/ruby-style-guide that referenced this pull request Mar 15, 2017
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.

None yet

3 participants