Logical expressions that always return the same value can more cleanly and clearly be replaced with that value. More probably, the fact that such expressions always return the same value is an indication of an error in the logic.


== Noncompliant Code Example

----
int i = 2;
int j = 4;

int k = true ? i : j; // Noncompliant; k always assigned i's value
int m = i > j ? i+2: j -1;  // Noncompliant; m always 3
----

