
org.sonar.l10n.javascript.rules.javascript.AssignmentWithinCondition.html Maven / Gradle / Ivy
Assignments within sub-expressions are hard to spot and therefore make the code less readable.
It is also a common mistake to write =
when ==
was meant.
Ideally, expressions should not have side-effects.
Noncompliant Code Example
doSomething(i = 42);
Compliant Solution
i = 42;
doSomething(i);
or
i = 42;
doSomething(i);
Exceptions
Assignments enclosed in relational expressions are allowed.
while ((line = nextLine()) != null) { }
© 2015 - 2025 Weber Informatics LLC | Privacy Policy