Skip to content

Files

Latest commit

 

History

History
44 lines (31 loc) · 872 Bytes

Style-PreferredHashMethods.md

File metadata and controls

44 lines (31 loc) · 872 Bytes

Pattern: Inconsistent use of hash method

Issue: -

Description

This rule (by default) checks for uses of methods Hash#has_key? and Hash#has_value? where it enforces Hash#key? and Hash#value?. It is configurable to enforce the inverse, using verbose method names also.

Examples

# EnforcedStyle: short (default)

# bad
Hash#has_key?
Hash#has_value?

# good
Hash#key?
Hash#value?
# EnforcedStyle: verbose

# bad
Hash#key?
Hash#value?

# good
Hash#has_key?
Hash#has_value?

Default configuration

Attribute Value
EnforcedStyle short
SupportedStyles short, verbose

Further Reading