Skip to content

CV05 — Compare with NULL using IS NULL / IS NOT NULL

Group: Convention · Auto-fixable: yes

x = NULL and x <> NULL are never true — NULL comparisons via =/<> always yield NULL. Use IS NULL / IS NOT NULL. Fixed automatically when NULL is on the right-hand side.

bad: WHERE deleted_at = NULL
good: WHERE deleted_at IS NULL

Disable this rule in banshee.toml:

[lint]
exclude = ["CV05"]

Or silence one line with -- noqa: CV05. See Linting.