When an assignment is made in a return statement, the assigned value is returned and the assignment does take place. But if the assigned variable is local to the method, the assignment itself is simply wasted code. 


Whether the variable is local or not, it makes for confusing code that will leave maintainers scratching their heads, wondering at the real intent.


== Noncompliant Code Example

----
public int getNumber() {
  int a = 0;
  return a = 8;  // Noncompliant
}
----


== Compliant Solution

----
public int getNumber() {
  int a = 0;
  return 8;
}
----

