CA001 - Self Assignment


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


Replace left or right side with something else than the other element.

In the example, replace one of the a by something else.

See Also: CA071 - Self-comparison

cached: 07/14/2024 2:12:35.000 PM