- This is not the released version of the documentation. Recommended Version
- Tags:
- analysis
- comparison
- expression
CA071 - Self-comparison
Description
An expression comparing a variable to itself always evaluates to the same boolean value. The comparison is thus redundant. In an Until expression it may lead to non-termination. Usually it is a typing error.
- Scope InstructionStatus EnabledSeverity WarningApplicability AllScore 70
Example of violation
Recommendation
Replace left or right side of comparison with something else than the other element.
In the example, replace
See Also: CA001 - Self Assignment
Back to Rules