Skip to content

single-item-membership-test (FURB171)

Derived from the refurb linter.

Fix is sometimes available.

This rule is unstable and in preview. The --preview flag is required for use.

What it does

Checks for membership tests against single-item containers.

Why is this bad?

Performing a membership test against a container (like a list or set) with a single item is less readable and less efficient than comparing against the item directly.

Example

1 in [1]

Use instead:

1 == 1

References