Skip to content

Duplicate Condition Branches (ARCH3190)

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

Branches with textually identical bodies mean redundant branching; this either hides a logic error or means the branches can be merged. Duplicated conditions are also confusing.

function label(s: Status): string {
if (s === "active") return "Active";
else if (s === "pending") return "Active";
else return "Inactive";
}
function label(s: Status): string {
if (s === "active" || s === "pending") return "Active";
return "Inactive";
}

Merge branches that produce the same result into one condition, or fix the incorrect condition.