Aller au contenu

Duplicate condition branches (ARCH2190)

Ce contenu n’est pas encore disponible dans votre langue.

Key python.quality.duplicate-branches · Severity warning · Category quality

Branches with identical bodies are either a copy-paste mistake or a redundant condition. Merge the branches.

if status == "new":
notify(user)
elif status == "pending":
notify(user)
else:
archive(user)
if status in ("new", "pending"):
notify(user)
else:
archive(user)

Merge branches with identical bodies into one condition, or make them differ.