V7012. The conditional expression always returns the same value.
The analyzer detected a potential error in the use of the ?: ternary operator. The same action is performed for both possible outcomes of the condition. Most likely, there is a typo in the code or it is redundant.
Look at this example:
let result = flag ? x : x;
The result variable is always assigned the value of the x variable. Most likely, a developer intended to use another variable:
let result = flag ? x : y;
Non-identical but equivalent expressions are also taken into account. For example, for this code snippet:
let result = flag ? x * y : y * x;
The analyzer issues a warning, as the multiplication is commutative and the result will be equivalent.