Version
- Tags:
- analysis
- redundant code
CA001 - Self Assignment
Description
Assigning a variable to itself is a meaningless instruction due to a typing error. Most probably, one of the two variable names was misspelled. One example among many others: the programmer wanted to assign a local variable to a class attribute and used one of the variable names twice.
Scope Instruction Status Enabled Severity Warning Applicability All Score 70
Example of violation
a := a
Recommendation
Replace left or right side with something else than the other element.
In the example, replace one of the a
by something else.
Back to Rules