Skip to content

Files

Latest commit

 

History

History
32 lines (21 loc) · 711 Bytes

Style-NonNilCheck.md

File metadata and controls

32 lines (21 loc) · 711 Bytes

Pattern: Redundant nil check

Issue: -

Description

This rule checks for non-nil checks, which are usually redundant. Non-nil checks are allowed if they are the final nodes of predicate.

Examples

# bad
if x != nil

# good (when not allowing semantic changes)
# bad (when allowing semantic changes)
if !x.nil?

# good (when allowing semantic changes)
if x

Default configuration

Attribute Value
IncludeSemanticChanges false

Further Reading