This rule raises an issue when the same class appears more than once in the inheritance list of a class definition.
In Python, a class definition can inherit from one or more base classes. When the same base class appears multiple times in the inheritance list, it serves no purpose and is always a programming error. Python's Method Resolution Order (MRO) ensures that each class appears only once in the inheritance chain, even if it is listed multiple times.
This typically happens due to copy-paste errors, misunderstanding of inheritance, or refactoring mistakes.
Remove the duplicate base class from the inheritance list, keeping only one occurrence.
class MyWidget(QWidget, Serializable, QWidget): # Noncompliant
pass
class MyWidget(QWidget, Serializable):
pass