Skip to content

Files

Latest commit

 

History

History
29 lines (19 loc) · 691 Bytes

NullableBooleanCheck.md

File metadata and controls

29 lines (19 loc) · 691 Bytes

Pattern: Use of ?:

Issue: -

Description

Detects nullable boolean checks which use an elvis expression ?: rather than equals ==.

Per the Kotlin coding conventions converting a nullable boolean property to non-null should be done via != false or == true rather than ?: true or ?: false (respectively).

Example of incorrect code:

value ?: true
value ?: false

Example of correct code:

value != false
value == true

Further Reading