Acton
Linting rules

E026: duplicated-condition

Detects duplicated conditions in `if / else if` chains.

Metadata

  • Code: E026
  • Rule: duplicated-condition
  • Status: Stable since v0.0.1
  • Quick fix: not available

What it does

Detects duplicated conditions in if / else if chains.

Why is this bad?

Repeating the same condition in one conditional chain usually means a copy-paste bug and can make branches unreachable.

Example

if (a < 1) {
    return 1;
} else if (a > 4) {
    return 2;
} else if (a > 4) {
E026: duplicated condition in conditional chain
return 3; }
Source code

Last updated on

On this page