When a class field is defined multiple times in the same class body, only the last assignment takes effect. All previous assignments are dead code that serve no purpose.
This pattern typically occurs due to copy-paste errors, refactoring mistakes, merge conflicts, or misunderstanding of how class attributes work.
Remove all but the last assignment to the class field.
class MyClass:
x = 1
y = 2
x = 3 # Noncompliant: "x" is defined twice
class MyClass:
x = 3
y = 2