in-empty-collection (RUF060)
This rule is unstable and in preview. The --preview
flag is required for use.
What it does
Checks for membership tests on empty collections (such as list
, tuple
, set
or dict
).
Why is this bad?
If the collection is always empty, the check is unnecessary, and can be removed.
Example
Use instead: