org.sonar.l10n.javascript.rules.javascript.S4165.html Maven / Gradle / Ivy
Why is this an issue?
The transitive property says that if a == b
and b == c
, then a == c
. In such cases, there’s no point in
assigning a
to c
or vice versa because they’re already equivalent.
This rule raises an issue when an assignment is useless because the assigned-to variable already holds the value on all execution paths.
Noncompliant code example
a = b;
c = a;
b = c; // Noncompliant: c and b are already the same
Compliant solution
a = b;
c = a;