Skip to content

Files

Latest commit

 

History

History
23 lines (15 loc) · 471 Bytes

Rails-NegateInclude.md

File metadata and controls

23 lines (15 loc) · 471 Bytes

Pattern: Use of !collection.include?(obj) instead of collection.exclude?(obj)

Issue: -

Description

This rule enforces the use of collection.exclude?(obj) over !collection.include?(obj).

Examples

# bad
!array.include?(2)
!hash.include?(:key)

# good
array.exclude?(2)
hash.exclude?(:key)

Further Reading